Class ProfileTokenProvider
- java.lang.Object
-
- software.amazon.awssdk.auth.token.credentials.ProfileTokenProvider
-
- All Implemented Interfaces:
AutoCloseable
,SdkTokenProvider
,IdentityProvider<TokenIdentity>
,SdkAutoCloseable
public final class ProfileTokenProvider extends Object implements SdkTokenProvider, SdkAutoCloseable
Token provider based on AWS configuration profiles. This loads token providers that requireProfileFile
configuration, allowing the user to share settings between different tools like the AWS SDK for Java and the AWS CLI.See http://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html
- See Also:
ProfileFile
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
ProfileTokenProvider.Builder
A builder for creating a customProfileTokenProvider
.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static ProfileTokenProvider.Builder
builder()
Get a builder for creating a customProfileTokenProvider
.void
close()
static ProfileTokenProvider
create()
Create aProfileTokenProvider
using theProfileFile.defaultProfileFile()
and default profile name.static ProfileTokenProvider
create(String profileName)
Create aProfileTokenProvider
using the given profile name andProfileFile.defaultProfileFile()
.SdkToken
resolveToken()
Returns anSdkToken
that can be used to authorize a request.String
toString()
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface software.amazon.awssdk.identity.spi.IdentityProvider
resolveIdentity, resolveIdentity
-
Methods inherited from interface software.amazon.awssdk.auth.token.credentials.SdkTokenProvider
identityType, resolveIdentity
-
-
-
-
Method Detail
-
create
public static ProfileTokenProvider create()
Create aProfileTokenProvider
using theProfileFile.defaultProfileFile()
and default profile name. Usebuilder()
for defining a customProfileTokenProvider
.
-
create
public static ProfileTokenProvider create(String profileName)
Create aProfileTokenProvider
using the given profile name andProfileFile.defaultProfileFile()
. Usebuilder()
for defining a customProfileTokenProvider
.- Parameters:
profileName
- the name of the profile to use from theProfileFile.defaultProfileFile()
-
builder
public static ProfileTokenProvider.Builder builder()
Get a builder for creating a customProfileTokenProvider
.
-
resolveToken
public SdkToken resolveToken()
Description copied from interface:SdkTokenProvider
Returns anSdkToken
that can be used to authorize a request. Each implementation of SdkTokenProvider can choose its own strategy for loading token. For example, an implementation might load token from an existing key management system, or load new token when token is refreshed.- Specified by:
resolveToken
in interfaceSdkTokenProvider
- Returns:
- AwsToken which the caller can use to authorize an AWS request using token authorization for a request.
-
close
public void close()
- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceSdkAutoCloseable
-
-