org.apache.accumulo.core.client.security.tokens
Class AuthenticationToken.AuthenticationTokenSerializer

java.lang.Object
  extended by org.apache.accumulo.core.client.security.tokens.AuthenticationToken.AuthenticationTokenSerializer
Enclosing interface:
AuthenticationToken

public static final class AuthenticationToken.AuthenticationTokenSerializer
extends Object

A utility class to serialize/deserialize AuthenticationToken objects.
Unfortunately, these methods are provided in an inner-class, to avoid breaking the interface API.

Since:
1.6.0

Constructor Summary
AuthenticationToken.AuthenticationTokenSerializer()
           
 
Method Summary
static
<T extends AuthenticationToken>
T
deserialize(Class<T> tokenType, byte[] tokenBytes)
          A convenience method to create tokens from serialized bytes, created by serialize(AuthenticationToken)
static AuthenticationToken deserialize(String tokenClassName, byte[] tokenBytes)
          An alternate version of deserialize(Class, byte[]) that accepts a token class name rather than a token class.
static byte[] serialize(AuthenticationToken token)
          A convenience method to serialize tokens.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AuthenticationToken.AuthenticationTokenSerializer

public AuthenticationToken.AuthenticationTokenSerializer()
Method Detail

deserialize

public static <T extends AuthenticationToken> T deserialize(Class<T> tokenType,
                                                            byte[] tokenBytes)
A convenience method to create tokens from serialized bytes, created by serialize(AuthenticationToken)

The specified tokenType will be instantiated, and used to deserialize the decoded bytes. The resulting object will then be returned to the caller.

Parameters:
tokenType - the token class to use to deserialize the bytes
tokenBytes - the token-specific serialized bytes
Returns:
an AuthenticationToken instance of the type specified by tokenType
See Also:
serialize(AuthenticationToken)

deserialize

public static AuthenticationToken deserialize(String tokenClassName,
                                              byte[] tokenBytes)
An alternate version of deserialize(Class, byte[]) that accepts a token class name rather than a token class.

Parameters:
tokenClassName - the fully-qualified class name to be returned
See Also:
serialize(AuthenticationToken)

serialize

public static byte[] serialize(AuthenticationToken token)
A convenience method to serialize tokens.

The provided AuthenticationToken will be serialized to bytes by its own implementation and returned to the caller.

Parameters:
token - the token to serialize
Returns:
a serialized representation of the provided AuthenticationToken
See Also:
deserialize(Class, byte[])


Copyright © 2015 Apache Accumulo Project. All rights reserved.