@InterfaceAudience.Private public class S3ADelegationTokens extends AbstractDTService
| Modifier and Type | Class and Description |
|---|---|
static class |
S3ADelegationTokens.TokenIssuingPolicy
How will tokens be issued on request?
The
S3ADelegationTokens.TokenIssuingPolicy.RequestNewToken policy does not guarantee that a tokens
can be created, only that an attempt will be made to request one. |
| Modifier and Type | Field and Description |
|---|---|
protected static EnumSet<AWSPolicyProvider.AccessLevel> |
ACCESS_POLICY
The access policies we want for operations.
|
static String |
E_DELEGATION_TOKENS_DISABLED |
| Constructor and Description |
|---|
S3ADelegationTokens()
Instantiate.
|
| Modifier and Type | Method and Description |
|---|---|
void |
bindToDelegationToken(org.apache.hadoop.security.token.Token<AbstractS3ATokenIdentifier> token)
Bind to a delegation token retrieved for this filesystem.
|
void |
bindToFileSystem(URI uri,
StoreContext context,
DelegationOperations delegationOperations)
Bind to the filesystem.
|
org.apache.hadoop.security.token.Token<AbstractS3ATokenIdentifier> |
createDelegationToken(EncryptionSecrets encryptionSecrets,
org.apache.hadoop.io.Text renewer)
Create a delegation token for the user.
|
AbstractS3ATokenIdentifier |
extractIdentifier(org.apache.hadoop.security.token.Token<? extends AbstractS3ATokenIdentifier> token)
From a token, get the session token identifier.
|
org.apache.hadoop.security.token.DelegationTokenIssuer[] |
getAdditionalTokenIssuers()
Get a null/possibly empty list of extra delegation token issuers.
|
Optional<org.apache.hadoop.security.token.Token<AbstractS3ATokenIdentifier>> |
getBoundDT()
Get any bound DT.
|
org.apache.hadoop.security.token.Token<AbstractS3ATokenIdentifier> |
getBoundOrNewDT(EncryptionSecrets encryptionSecrets,
org.apache.hadoop.io.Text renewer)
Get any bound DT or create a new one.
|
String |
getCanonicalServiceName()
The canonical name of the service.
|
int |
getCreationCount()
How many delegation tokens have been issued?
|
AWSCredentialProviderList |
getCredentialProviders()
Get the AWS credential provider.
|
Optional<AbstractS3ATokenIdentifier> |
getDecodedIdentifier()
Get any decoded identifier from the bound DT; empty if not bound.
|
Optional<EncryptionSecrets> |
getEncryptionSecrets()
Get the encryption secrets of the DT.
|
org.apache.hadoop.io.Text |
getService()
Get the service identifier of the owning FS.
|
S3ADelegationTokens.TokenIssuingPolicy |
getTokenIssuingPolicy()
Predicate: will this binding issue a DT if requested
in a call to
getBoundOrNewDT(EncryptionSecrets, Text)?
That is: should the filesystem declare that it is issuing
delegation tokens? |
org.apache.hadoop.io.Text |
getTokenKind()
Get the kind of the issued tokens.
|
String |
getUserAgentField()
Return a string for use in building up the User-Agent field, so
get into the S3 access logs.
|
static boolean |
hasDelegationTokenBinding(org.apache.hadoop.conf.Configuration conf)
Predicate: does this configuration enable delegation tokens?
That is: is there any text in the option
DelegationConstants.DELEGATION_TOKEN_BINDING ? |
boolean |
isBoundToDT()
Predicate: is there a bound DT?
|
static org.apache.hadoop.security.token.Token<AbstractS3ATokenIdentifier> |
lookupS3ADelegationToken(org.apache.hadoop.security.Credentials credentials,
URI uri)
Look for any S3A token for the given FS service.
|
static org.apache.hadoop.security.token.Token<AbstractS3ATokenIdentifier> |
lookupToken(org.apache.hadoop.security.Credentials credentials,
org.apache.hadoop.io.Text service)
Look up any token from the service; cast it to one of ours.
|
static org.apache.hadoop.security.token.Token<AbstractS3ATokenIdentifier> |
lookupToken(org.apache.hadoop.security.Credentials credentials,
org.apache.hadoop.io.Text service,
org.apache.hadoop.io.Text kind)
Look up a token from the credentials, verify it is of the correct
kind.
|
org.apache.hadoop.security.token.Token<AbstractS3ATokenIdentifier> |
selectTokenFromFSOwner()
Find a token for the FS user and canonical filesystem URI.
|
protected void |
serviceInit(org.apache.hadoop.conf.Configuration conf)
Init the service.
|
protected void |
serviceStart()
Service startup includes binding to any delegation token, and
deploying unbounded if there is none.
|
protected void |
serviceStop()
Stop the token binding.
|
String |
toString() |
getCanonicalUri, getOwner, getPolicyProvider, getStoreContext, requireServiceStarted, requireServiceStateclose, getBlockers, getConfig, getFailureCause, getFailureState, getLifecycleHistory, getName, getServiceState, getStartTime, init, isInState, noteFailure, putBlocker, registerGlobalListener, registerServiceListener, removeBlocker, setConfig, start, stop, unregisterGlobalListener, unregisterServiceListener, waitForServiceToStoppublic static final String E_DELEGATION_TOKENS_DISABLED
protected static final EnumSet<AWSPolicyProvider.AccessLevel> ACCESS_POLICY
public S3ADelegationTokens()
throws IOException
IOException - if login fails.public void bindToFileSystem(URI uri, StoreContext context, DelegationOperations delegationOperations) throws IOException
AbstractDTServiceinit().
Important:
This binding will happen during FileSystem.initialize(); the FS
is not live for actual use and will not yet have interacted with
AWS services.bindToFileSystem in class AbstractDTServiceuri - the canonical URI of the FS.context - store contextdelegationOperations - delegation operationsIOException - failure.protected void serviceInit(org.apache.hadoop.conf.Configuration conf)
throws Exception
serviceInit in class AbstractDTServiceconf - configurationException - any failure to start upprotected void serviceStart()
throws Exception
serviceStart in class org.apache.hadoop.service.AbstractServiceException - any failureprotected void serviceStop()
throws Exception
serviceStop in class org.apache.hadoop.service.AbstractServiceException - on any failure@VisibleForTesting public void bindToDelegationToken(org.apache.hadoop.security.token.Token<AbstractS3ATokenIdentifier> token) throws IOException
boundDT is set to token.decodedIdentifier is set to the extracted identifier.bindingInfo is set to the info
returned by the token binding.token - token to decode and bind to.IOException - selection/extraction/validation failure.public boolean isBoundToDT()
boundDT.public Optional<org.apache.hadoop.security.token.Token<AbstractS3ATokenIdentifier>> getBoundDT()
public S3ADelegationTokens.TokenIssuingPolicy getTokenIssuingPolicy()
getBoundOrNewDT(EncryptionSecrets, Text)?
That is: should the filesystem declare that it is issuing
delegation tokens?public org.apache.hadoop.security.token.Token<AbstractS3ATokenIdentifier> getBoundOrNewDT(EncryptionSecrets encryptionSecrets, org.apache.hadoop.io.Text renewer) throws IOException
encryptionSecrets - encryption secrets for any new token.renewer - the token renewer.IOException - if one cannot be createdpublic int getCreationCount()
createDelegationToken(EncryptionSecrets, Text)
returned a token.@VisibleForTesting public org.apache.hadoop.security.token.Token<AbstractS3ATokenIdentifier> createDelegationToken(EncryptionSecrets encryptionSecrets, org.apache.hadoop.io.Text renewer) throws IOException
encryptionSecrets - encryption secrets for the token.renewer - the token renewerIOException - if one cannot be createdpublic org.apache.hadoop.security.token.DelegationTokenIssuer[] getAdditionalTokenIssuers()
throws IOException
DelegationTokenIssuer.getAdditionalTokenIssuers() recursively
collects all DTs a filesystem can offer.IOException - failurepublic AWSCredentialProviderList getCredentialProviders() throws IOException
IOException - failure to parse the DTIllegalStateException - if this instance is not bound to a DTpublic Optional<EncryptionSecrets> getEncryptionSecrets()
public Optional<AbstractS3ATokenIdentifier> getDecodedIdentifier()
public org.apache.hadoop.io.Text getService()
public String getCanonicalServiceName()
@VisibleForTesting public org.apache.hadoop.security.token.Token<AbstractS3ATokenIdentifier> selectTokenFromFSOwner() throws IOException
IOException - on a failure to unmarshall the token.public String toString()
toString in class org.apache.hadoop.service.AbstractServicepublic org.apache.hadoop.io.Text getTokenKind()
public AbstractS3ATokenIdentifier extractIdentifier(org.apache.hadoop.security.token.Token<? extends AbstractS3ATokenIdentifier> token) throws IOException
token - token to processIOException - failure to validate/read data encoded in identifier.IllegalArgumentException - if the token isn't an S3A session tokenpublic String getUserAgentField()
AbstractDelegationTokenBinding.getUserAgentField()}
for the current binding.@VisibleForTesting public static org.apache.hadoop.security.token.Token<AbstractS3ATokenIdentifier> lookupToken(org.apache.hadoop.security.Credentials credentials, org.apache.hadoop.io.Text service, org.apache.hadoop.io.Text kind) throws DelegationTokenIOException
credentials - credentials to look up.service - service namekind - token kind to look forDelegationTokenIOException - wrong token kind foundpublic static org.apache.hadoop.security.token.Token<AbstractS3ATokenIdentifier> lookupToken(org.apache.hadoop.security.Credentials credentials, org.apache.hadoop.io.Text service)
credentials - credentialsservice - service to look upClassCastException - if the token is of a wrong type.public static org.apache.hadoop.security.token.Token<AbstractS3ATokenIdentifier> lookupS3ADelegationToken(org.apache.hadoop.security.Credentials credentials, URI uri)
credentials - credentials to scan.uri - the URI of the FS to look forpublic static boolean hasDelegationTokenBinding(org.apache.hadoop.conf.Configuration conf)
DelegationConstants.DELEGATION_TOKEN_BINDING ?conf - configuration to examineCopyright © 2008–2024 Apache Software Foundation. All rights reserved.