Class AwsIotWebSocketUrlSigner

java.lang.Object
com.amazonaws.services.iot.client.util.AwsIotWebSocketUrlSigner

public class AwsIotWebSocketUrlSigner extends Object
The AWSIotWebSocketUrlSigner class creates the SigV4 signature and builds a connection URL to be used with the Paho MQTT client.
  • Constructor Details

    • AwsIotWebSocketUrlSigner

      public AwsIotWebSocketUrlSigner(String endpoint)
      Deprecated.
      use provider-based constructor
      Instantiates a new URL signer instance with endpoint only.
      Parameters:
      endpoint - service endpoint with or without customer specific URL prefix.
    • AwsIotWebSocketUrlSigner

      public AwsIotWebSocketUrlSigner(String endpoint, String region)
      Instantiate a new URL signer with endpoint and region.
      Parameters:
      endpoint - service endpoint with or without customer specific URL prefix.
      region - The AWS region
    • AwsIotWebSocketUrlSigner

      public AwsIotWebSocketUrlSigner(String endpoint, CredentialsProvider provider, String region)
      Instantiate a new URL signer with endpoint, region and source of credentials
      Parameters:
      endpoint - service endpoint with or without customer specific URL prefix.
      provider - credentials provider to source AWS credentials from
      region - The AWS region
    • AwsIotWebSocketUrlSigner

      public AwsIotWebSocketUrlSigner(String endpoint, String awsAccessKeyId, String awsSecretAccessKey, String sessionToken)
      Instantiates a new URL signer instance with endpoint and credentials.
      Parameters:
      endpoint - service endpoint with or without customer specific URL prefix.
      awsAccessKeyId - AWS access key ID used in SigV4 signature algorithm.
      awsSecretAccessKey - AWS secret access key used in SigV4 signature algorithm.
      sessionToken - Session token for temporary credentials.
    • AwsIotWebSocketUrlSigner

      public AwsIotWebSocketUrlSigner(String endpoint, String awsAccessKeyId, String awsSecretAccessKey, String sessionToken, String region)
      Instantiates a new URL signer instance with endpoint and credentials.
      Parameters:
      endpoint - service endpoint with or without customer specific URL prefix.
      awsAccessKeyId - AWS access key ID used in SigV4 signature algorithm.
      awsSecretAccessKey - AWS secret access key used in SigV4 signature algorithm.
      sessionToken - Session token for temporary credentials.
      region - The AWS region
  • Method Details

    • updateCredentials

      public void updateCredentials(String awsAccessKeyId, String awsSecretAccessKey, String sessionToken)
      Updates the signing credentials.
      Parameters:
      awsAccessKeyId - AWS access key ID used in SigV4 signature algorithm.
      awsSecretAccessKey - AWS secret access key used in SigV4 signature algorithm.
      sessionToken - Session token for temporary credentials.
    • getSignedUrl

      public String getSignedUrl(Date signingDate) throws AWSIotException
      Given the signing date return a signed connection URL to be used when connecting via WebSocket to AWS IoT.
      Parameters:
      signingDate - time value to be used in SigV4 calculations. System current time will be used if null.
      Returns:
      a URL with SigV4 signature formatted to be used with AWS IoT.
      Throws:
      AWSIotException - Exception thrown when signed URL can be generated with given information.
    • getRegion

      public String getRegion()
      Returns:
      the region this signer is configured to sign against