Package com.amazonaws.kinesisvideo.auth
Class KinesisVideoCredentials
- java.lang.Object
-
- com.amazonaws.kinesisvideo.auth.KinesisVideoCredentials
-
- All Implemented Interfaces:
Serializable
@Immutable @ThreadSafe public class KinesisVideoCredentials extends Object implements Serializable
Credentials object containing AWS credentials. They might be temporary (using a session token). Consumer is responsible for checking theexpirationbefore using the credentials.If the credentials are non-temporary, the session token will be
nulland the expiration will begetCredentialsNeverExpire().- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static DateCREDENTIALS_NEVER_EXPIREDeprecated.This exposes a mutable Date object.
-
Constructor Summary
Constructors Constructor Description KinesisVideoCredentials(String accessKey, String secretKey)Constructor for non-temporary credentials.KinesisVideoCredentials(String accessKey, String secretKey, String sessionToken, Date expiration)Constructor for temporary credentials.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description StringgetAccessKey()static DategetCredentialsNeverExpire()Returns a defensive copy of the sentinel value indicating credentials never expire.DategetExpiration()StringgetSecretKey()StringgetSessionToken()booleanisTemporary()Checks if the credentials are temporary or not.
-
-
-
Field Detail
-
CREDENTIALS_NEVER_EXPIRE
@Deprecated public static final Date CREDENTIALS_NEVER_EXPIRE
Deprecated.This exposes a mutable Date object. UsegetCredentialsNeverExpire()instead.Sentinel value indicating the credentials never expire.
-
-
Constructor Detail
-
KinesisVideoCredentials
public KinesisVideoCredentials(@Nonnull String accessKey, @Nonnull String secretKey)
Constructor for non-temporary credentials.- Parameters:
accessKey- AWS Access Key ID, must not be null or emptysecretKey- AWS Secret Key, must not be null or empty- Throws:
IllegalArgumentException- if accessKey or secretKey is null or empty
-
KinesisVideoCredentials
public KinesisVideoCredentials(@Nonnull String accessKey, @Nonnull String secretKey, @Nullable String sessionToken, @Nonnull Date expiration)
Constructor for temporary credentials.- Parameters:
accessKey- AWS Access Key ID, must not be null or emptysecretKey- AWS Secret Key, must not be null or emptysessionToken- AWS Session Token, must not be empty if providedexpiration- When this set of credentials expire, must not be null- Throws:
IllegalArgumentException- if accessKey, secretKey, or sessionToken is empty, or if any required parameter is null, or if a session token is provided for non-temporary credentials
-
-
Method Detail
-
getCredentialsNeverExpire
@Nonnull public static Date getCredentialsNeverExpire()
Returns a defensive copy of the sentinel value indicating credentials never expire. This method should be used instead of the deprecatedCREDENTIALS_NEVER_EXPIREconstant to maintain immutability.- Returns:
- A new Date instance representing credentials that never expire
-
getSessionToken
@Nullable public String getSessionToken()
- Returns:
- AWS Session Token. If the credentials are non-temporary, this will be
null. Otherwise, non-empty.
-
getExpiration
@Nonnull public Date getExpiration()
- Returns:
- When the credentials will no longer be valid. If the credentials are non-temporary,
this will be
getCredentialsNeverExpire().
-
isTemporary
public boolean isTemporary()
Checks if the credentials are temporary or not.- Returns:
- true if the credentials are temporary (have an expiration).
-
-