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 Summary
Constructors Constructor Description AwsIotWebSocketUrlSigner(String endpoint)Instantiates a new URL signer instance with endpoint only.AwsIotWebSocketUrlSigner(String endpoint, String region)Instantiate a new URL signer with endpoint and region.AwsIotWebSocketUrlSigner(String endpoint, String awsAccessKeyId, String awsSecretAccessKey, String sessionToken)Instantiates a new URL signer instance with endpoint and credentials.AwsIotWebSocketUrlSigner(String endpoint, String awsAccessKeyId, String awsSecretAccessKey, String sessionToken, String region)Instantiates a new URL signer instance with endpoint and credentials.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetRegion()StringgetSignedUrl(Date signingDate)Given the signing date return a signed connection URL to be used when connecting via WebSocket to AWS IoT.voidupdateCredentials(String awsAccessKeyId, String awsSecretAccessKey, String sessionToken)Updates the signing credentials.
-
-
-
Constructor Detail
-
AwsIotWebSocketUrlSigner
public AwsIotWebSocketUrlSigner(String endpoint)
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, 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 Detail
-
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
-
-