public class BlobCrypterSecurityTokenCodec extends Object implements SecurityTokenCodec, ContainerConfig.ConfigObserver
dd if=/dev/random bs=32 count=1 | openssl base64 > /tmp/key.txt
Wire format is "<container>:<encrypted-and-signed-token>"| Modifier and Type | Field and Description |
|---|---|
protected Map<String,BlobCrypter> |
crypters
Keys are container ids, values are crypters
|
protected Map<String,String> |
domains
Keys are container ids, values are domains used for signed fetch.
|
static String |
SECURITY_TOKEN_KEY |
static String |
SIGNED_FETCH_DOMAIN |
ACTIVE_URL_NAME, SECURITY_TOKEN_NAME, SECURITY_TOKEN_TTL_CONFIG| Constructor and Description |
|---|
BlobCrypterSecurityTokenCodec(ContainerConfig config) |
| Modifier and Type | Method and Description |
|---|---|
void |
containersChanged(ContainerConfig config,
Collection<String> changed,
Collection<String> removed)
Notifies the object that some container configurations have been added or
modified.
|
SecurityToken |
createToken(Map<String,String> tokenParameters)
Decrypt and verify the provided security token.
|
String |
encodeToken(SecurityToken token)
Encrypt and sign the token.
|
int |
getTokenTimeToLive()
This method is deprecated in favor of
SecurityTokenCodec.getTokenTimeToLive(String). |
int |
getTokenTimeToLive(String container) |
protected BlobCrypter |
loadCrypter(String key)
Load a BlobCrypter using the specified key.
|
public static final String SECURITY_TOKEN_KEY
public static final String SIGNED_FETCH_DOMAIN
protected Map<String,BlobCrypter> crypters
@Inject public BlobCrypterSecurityTokenCodec(ContainerConfig config)
public void containersChanged(ContainerConfig config, Collection<String> changed, Collection<String> removed)
ContainerConfig.ConfigObservercontainersChanged in interface ContainerConfig.ConfigObserverconfig - The ContainerConfig object where the configuration was
changed.changed - The names of the containers that have been added or
modified.removed - The names of the containers that have been removed.protected BlobCrypter loadCrypter(String key)
key - The security token key.public SecurityToken createToken(Map<String,String> tokenParameters) throws SecurityTokenException
createToken in interface SecurityTokenCodectokenParameters - Map containing a entry 'token' in wire format (probably encrypted.)SecurityTokenException - If tokenString is not a valid tokenpublic String encodeToken(SecurityToken token) throws SecurityTokenException
encodeToken in interface SecurityTokenCodecSecurityTokenExceptionpublic int getTokenTimeToLive()
SecurityTokenCodecSecurityTokenCodec.getTokenTimeToLive(String).
Implementations should only rely on this method to return the default time-to-live of tokens
generated by this codec in the case where getTokenTimeToLive(String) fails.getTokenTimeToLive in interface SecurityTokenCodecSecurityTokenCodec.getTokenTimeToLive(String)public int getTokenTimeToLive(String container)
getTokenTimeToLive in interface SecurityTokenCodeccontainer - The container the token is forCopyright © 2007-2014 The Apache Software Foundation. All Rights Reserved.