public abstract class AbstractDelegationTokenBinding extends AbstractDTService
org.apache.hadoop.fs.azure.security.WasbDelegationTokenManager
but note that it assumes Kerberos tokens for which the renewal mechanism
is the sole plugin point.
This class is designed to be more generic.
Lifecycle
It is a Hadoop Service, so has a standard lifecycle: once started
its lifecycle will follow that of the S3ADelegationTokens
instance which created it --which itself follows the lifecycle of the FS.
One big difference is that
AbstractDTService.bindToFileSystem(URI, org.apache.hadoop.fs.s3a.impl.StoreContext, DelegationOperations)
will be called
before the AbstractService.init(Configuration) operation, this is where
the owning FS is passed in.
Implementations are free to start background operations in their
serviceStart() method, provided they are safely stopped in
serviceStop().
When to check for the ability to issue tokens
Implementations MUST start up without actually holding the secrets
needed to issue tokens (config options, credentials to talk to STS etc)
as in server-side deployments they are not expected to have these.
Retry Policy
All methods which talk to AWS services are expected to do translation,
with retries as they see fit.| Modifier and Type | Class and Description |
|---|---|
protected class |
AbstractDelegationTokenBinding.TokenSecretManager
The secret manager always uses the same secret; the
factory for new identifiers is that of the token manager.
|
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractDelegationTokenBinding(String name,
org.apache.hadoop.io.Text kind)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
AWSCredentialProviderList |
bindToTokenIdentifier(AbstractS3ATokenIdentifier retrievedIdentifier)
Bind to the token identifier, returning the credential providers to use
for the owner to talk to S3 and related AWS Services.
|
protected <T extends AbstractS3ATokenIdentifier> |
convertTokenIdentifier(AbstractS3ATokenIdentifier identifier,
Class<T> expectedClass)
Verify that a token identifier is of a specific class.
|
org.apache.hadoop.security.token.Token<AbstractS3ATokenIdentifier> |
createDelegationToken(Optional<RoleModel.Policy> policy,
EncryptionSecrets encryptionSecrets,
org.apache.hadoop.io.Text renewer)
Create a delegation token for the user.
|
abstract AbstractS3ATokenIdentifier |
createEmptyIdentifier()
Create a new subclass of
AbstractS3ATokenIdentifier. |
protected org.apache.hadoop.security.token.SecretManager<AbstractS3ATokenIdentifier> |
createSecretMananger()
Create a secret manager.
|
abstract AbstractS3ATokenIdentifier |
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.
|
DelegationBindingInfo |
deploy(AbstractS3ATokenIdentifier retrievedIdentifier)
Deploy, returning the binding information.
|
AWSCredentialProviderList |
deployUnbonded()
Perform any actions when deploying unbonded, and return a list
of credential providers.
|
String |
getDescription()
Return a description.
|
org.apache.hadoop.io.Text |
getKind()
Get the kind of the tokens managed here.
|
org.apache.hadoop.io.Text |
getOwnerText()
Return the name of the owner to be used in tokens.
|
protected static byte[] |
getSecretManagerPasssword()
Get the password to use in secret managers.
|
S3ADelegationTokens.TokenIssuingPolicy |
getTokenIssuingPolicy()
Predicate: will this binding issue a DT?
That is: should the filesystem declare that it is issuing
delegation tokens? If true
|
String |
getUserAgentField()
Return a string for use in building up the User-Agent field, so
get into the S3 access logs.
|
protected void |
serviceStart()
Service startup: create the secret manager.
|
String |
toString() |
bindToFileSystem, getCanonicalUri, getOwner, getPolicyProvider, getStoreContext, requireServiceStarted, requireServiceState, serviceInitclose, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, serviceStop, setConfig, start, stop, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStopprotected AbstractDelegationTokenBinding(String name, org.apache.hadoop.io.Text kind)
name - as passed to superclass for use in log messages.kind - token kind.public org.apache.hadoop.io.Text getKind()
public org.apache.hadoop.io.Text getOwnerText()
public S3ADelegationTokens.TokenIssuingPolicy getTokenIssuingPolicy()
public org.apache.hadoop.security.token.Token<AbstractS3ATokenIdentifier> createDelegationToken(Optional<RoleModel.Policy> policy, EncryptionSecrets encryptionSecrets, org.apache.hadoop.io.Text renewer) throws IOException
policy - minimum policy to use, if known.encryptionSecrets - encryption secrets for the token.renewer - the principal permitted to renew the token.IOException - if one cannot be createdpublic abstract AbstractS3ATokenIdentifier createTokenIdentifier(Optional<RoleModel.Policy> policy, EncryptionSecrets encryptionSecrets, org.apache.hadoop.io.Text renewer) throws IOException
createDelegationToken(Optional, EncryptionSecrets, Text)
is overridden, this method can be replaced with a stub.policy - minimum policy to use, if known.encryptionSecrets - encryption secrets for the token.renewer - the principal permitted to renew the token.IOException - failure creating the token data.protected <T extends AbstractS3ATokenIdentifier> T convertTokenIdentifier(AbstractS3ATokenIdentifier identifier, Class<T> expectedClass) throws DelegationTokenIOException
instanceof, then cast it to that type.T - type of S3A delegation ttoken identifier.identifier - identifier to validateexpectedClass - class of the expected token identifier.DelegationTokenIOException - If the wrong class was found.public DelegationBindingInfo deploy(AbstractS3ATokenIdentifier retrievedIdentifier) throws IOException
retrievedIdentifier - any identifier -null if deployed unbonded.IOException - any failure.public AWSCredentialProviderList deployUnbonded() throws IOException
IOException - any failure.UnsupportedOperationException - in the base implementation.public AWSCredentialProviderList bindToTokenIdentifier(AbstractS3ATokenIdentifier retrievedIdentifier) throws IOException
retrievedIdentifier - the unmarshalled dataIOException - any failureUnsupportedOperationException - in the base implementation.public abstract AbstractS3ATokenIdentifier createEmptyIdentifier()
AbstractS3ATokenIdentifier.
This is used in the secret manager.public String toString()
toString in class org.apache.hadoop.service.AbstractServiceprotected void serviceStart()
throws Exception
serviceStart in class org.apache.hadoop.service.AbstractServiceException - failure.public String getDescription()
protected org.apache.hadoop.security.token.SecretManager<AbstractS3ATokenIdentifier> createSecretMananger() throws IOException
IOException - on failurepublic String getUserAgentField()
protected static byte[] getSecretManagerPasssword()
Copyright © 2008–2024 Apache Software Foundation. All rights reserved.