Class SessionTokenBinding
java.lang.Object
org.apache.hadoop.service.AbstractService
org.apache.hadoop.fs.s3a.auth.delegation.AbstractDTService
org.apache.hadoop.fs.s3a.auth.delegation.AbstractDelegationTokenBinding
org.apache.hadoop.fs.s3a.auth.delegation.SessionTokenBinding
- All Implemented Interfaces:
Closeable,AutoCloseable,org.apache.hadoop.service.Service
- Direct Known Subclasses:
RoleTokenBinding
The session token DT binding: creates an AWS session token
for the DT, extracts and serves it up afterwards.
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.hadoop.fs.s3a.auth.delegation.AbstractDelegationTokenBinding
AbstractDelegationTokenBinding.TokenSecretManagerNested classes/interfaces inherited from interface org.apache.hadoop.service.Service
org.apache.hadoop.service.Service.STATE -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringA message added to the standard origin string when the DT is built from session credentials passed in.static final Invoker.RetriedLog retries at debug.static final String -
Constructor Summary
ConstructorsModifierConstructorDescriptionConstructor for reflection.protectedSessionTokenBinding(String name, org.apache.hadoop.io.Text kind) Constructor for subclasses. -
Method Summary
Modifier and TypeMethodDescriptionprotected StringGet the role of this token; subclasses should override this for better logging.bindToTokenIdentifier(AbstractS3ATokenIdentifier retrievedIdentifier) Sets the fieldtokenIdentifierto the extracted/cast session token identifier, andexpirationDateTimeto any expiration passed in.Create a new subclass ofAbstractS3ATokenIdentifier.createTokenIdentifier(Optional<RoleModel.Policy> policy, EncryptionSecrets encryptionSecrets, org.apache.hadoop.io.Text renewer) Create a token identifier with all the information needed to be included in a delegation token.Return an unbonded provider chain.Return a description.longDuration of sessions.protected Optional<OffsetDateTime>Expiration date time as passed in from source.protected InvokerGet the invoker for STS calls.protected AWSCredentialProviderListThe auth chain for the parent options.protected Optional<SessionTokenIdentifier>Token identifier bound to.UA field contains the UUID of the token if present.protected Optional<STSClientFactory.STSClient>Get the client to AWS STS.protected voidService start will read in all configuration options then build that client.protected voidprotected voidsetExpirationDateTime(Optional<OffsetDateTime> expirationDateTime) protected voidsetParentAuthChain(AWSCredentialProviderList parentAuthChain) protected voidsetTokenIdentifier(Optional<SessionTokenIdentifier> tokenIdentifier) Methods inherited from class org.apache.hadoop.fs.s3a.auth.delegation.AbstractDelegationTokenBinding
convertTokenIdentifier, createDelegationToken, createSecretMananger, deploy, getKind, getOwnerText, getSecretManagerPasssword, getTokenIssuingPolicy, toStringMethods inherited from class org.apache.hadoop.fs.s3a.auth.delegation.AbstractDTService
bindToFileSystem, getCanonicalUri, getOwner, getPolicyProvider, getStoreContext, requireServiceStarted, requireServiceState, serviceInitMethods inherited from class org.apache.hadoop.service.AbstractService
close, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStop
-
Field Details
-
CREDENTIALS_CONVERTED_TO_DELEGATION_TOKEN
A message added to the standard origin string when the DT is built from session credentials passed in.- See Also:
-
SESSION_TOKEN
- See Also:
-
LOG_EVENT
Log retries at debug.
-
-
Constructor Details
-
SessionTokenBinding
public SessionTokenBinding()Constructor for reflection. -
SessionTokenBinding
Constructor for subclasses.- Parameters:
name- binding name.kind- token kind.
-
-
Method Details
-
serviceStart
Service start will read in all configuration options then build that client.- Overrides:
serviceStartin classAbstractDelegationTokenBinding- Throws:
Exception- failure.
-
serviceStop
- Overrides:
serviceStopin classorg.apache.hadoop.service.AbstractService- Throws:
Exception
-
deployUnbonded
Return an unbonded provider chain.- Overrides:
deployUnbondedin classAbstractDelegationTokenBinding- Returns:
- the auth chain built from the assumed role credentials
- Throws:
IOException- any failure.
-
getInvoker
Get the invoker for STS calls.- Returns:
- the invoker
-
bindToTokenIdentifier
public AWSCredentialProviderList bindToTokenIdentifier(AbstractS3ATokenIdentifier retrievedIdentifier) throws IOException Sets the fieldtokenIdentifierto the extracted/cast session token identifier, andexpirationDateTimeto any expiration passed in.- Overrides:
bindToTokenIdentifierin classAbstractDelegationTokenBinding- Parameters:
retrievedIdentifier- the unmarshalled data- Returns:
- the provider list
- Throws:
IOException- failure
-
getDescription
Description copied from class:AbstractDelegationTokenBindingReturn a description. This is logged during after service start and binding: it should be as informative as possible.- Overrides:
getDescriptionin classAbstractDelegationTokenBinding- Returns:
- a description to log.
-
bindingName
Get the role of this token; subclasses should override this for better logging.- Returns:
- the role of this token
-
getUserAgentField
UA field contains the UUID of the token if present.- Overrides:
getUserAgentFieldin classAbstractDelegationTokenBinding- Returns:
- a string for the S3 logs.
-
prepareSTSClient
Get the client to AWS STS.- Returns:
- the STS client, when successfully inited.
- Throws:
IOException- any failure to bind to STS.
-
getDuration
public long getDuration()Duration of sessions.- Returns:
- duration in seconds.
-
createTokenIdentifier
@RetryTranslated public SessionTokenIdentifier createTokenIdentifier(Optional<RoleModel.Policy> policy, EncryptionSecrets encryptionSecrets, org.apache.hadoop.io.Text renewer) throws IOException Description copied from class:AbstractDelegationTokenBindingCreate a token identifier with all the information needed to be included in a delegation token. This is where session credentials need to be extracted, etc. This will only be called if a new DT is needed, that is: the filesystem has been deployed unbonded. IfAbstractDelegationTokenBinding.createDelegationToken(Optional, EncryptionSecrets, Text)is overridden, this method can be replaced with a stub.- Specified by:
createTokenIdentifierin classAbstractDelegationTokenBinding- Parameters:
policy- minimum policy to use, if known.encryptionSecrets- encryption secrets for the token.renewer- the principal permitted to renew the token.- Returns:
- the token data to include in the token identifier.
- Throws:
IOException- failure creating the token data.
-
createEmptyIdentifier
Description copied from class:AbstractDelegationTokenBindingCreate a new subclass ofAbstractS3ATokenIdentifier. This is used in the secret manager.- Specified by:
createEmptyIdentifierin classAbstractDelegationTokenBinding- Returns:
- an empty identifier.
-
getExpirationDateTime
Expiration date time as passed in from source. If unset, either we are unbound, or the token which came in does not know its expiry.- Returns:
- expiration data time.
-
setExpirationDateTime
-
getTokenIdentifier
Token identifier bound to.- Returns:
- token identifier.
-
setTokenIdentifier
-
getParentAuthChain
The auth chain for the parent options.- Returns:
- the parent authentication chain.
-
setParentAuthChain
-