org.apache.shindig.auth
Class BlobCrypterSecurityTokenCodec
java.lang.Object
org.apache.shindig.auth.BlobCrypterSecurityTokenCodec
- All Implemented Interfaces:
- SecurityTokenCodec
public class BlobCrypterSecurityTokenCodec
- extends Object
- implements SecurityTokenCodec
Provides security token decoding services. Configuration is via containers.js. Each container
should specify (or inherit)
securityTokenKeyFile: path to file containing a key to use for verifying tokens.
signedFetchDomain: oauth_consumer_key value to use for signed fetch using default key.
Creating a key is best done with a command line like this:
dd if=/dev/random bs=32 count=1 | openssl base64 > /tmp/key.txt
Wire format is "<container>:<encrypted-and-signed-token>"
- Since:
- 2.0.0
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
SECURITY_TOKEN_KEY_FILE
public static final String SECURITY_TOKEN_KEY_FILE
- See Also:
- Constant Field Values
SIGNED_FETCH_DOMAIN
public static final String SIGNED_FETCH_DOMAIN
- See Also:
- Constant Field Values
crypters
protected final Map<String,BlobCrypter> crypters
- Keys are container ids, values are crypters
domains
protected final Map<String,String> domains
- Keys are container ids, values are domains used for signed fetch.
BlobCrypterSecurityTokenCodec
@Inject
public BlobCrypterSecurityTokenCodec(ContainerConfig config)
loadCrypterFromFile
protected BlobCrypter loadCrypterFromFile(File file)
throws IOException
- Load a BlobCrypter from the specified file. Override this if you have your own
BlobCrypter implementation.
- Throws:
IOException
createToken
public SecurityToken createToken(Map<String,String> tokenParameters)
throws SecurityTokenException
- Decrypt and verify the provided security token.
- Specified by:
createToken in interface SecurityTokenCodec
- Parameters:
tokenParameters - Map containing a entry 'token' in wire format (probably encrypted.)
- Returns:
- the decrypted and verified token.
- Throws:
SecurityTokenException - If tokenString is not a valid token
encodeToken
public String encodeToken(SecurityToken token)
throws SecurityTokenException
- Specified by:
encodeToken in interface SecurityTokenCodec
- Throws:
SecurityTokenException
Copyright © 2007-2012. All Rights Reserved.