Class ClientTokenUtil
java.lang.Object
org.apache.hadoop.hbase.security.token.ClientTokenUtil
Utility methods for obtaining authentication tokens, that do not require hbase-server.
-
Field Summary
Modifier and TypeFieldDescriptionprivate static com.google.protobuf.ServiceException
private static final org.slf4j.Logger
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprivate static void
static void
obtainAndCacheToken
(Connection conn, User user) Obtain an authentication token for the given user and add it to the user's credentials.static org.apache.hadoop.security.token.Token<AuthenticationTokenIdentifier>
obtainToken
(Connection conn) Obtain and return an authentication token for the current user.(package private) static org.apache.hadoop.security.token.Token<AuthenticationTokenIdentifier>
obtainToken
(Connection conn, User user) Obtain and return an authentication token for the given user.(package private) static org.apache.hadoop.security.token.Token<AuthenticationTokenIdentifier>
toToken
(org.apache.hadoop.hbase.protobuf.generated.AuthenticationProtos.Token proto) Converts a protobuf Token message back into a Token instance.(package private) static org.apache.hadoop.hbase.protobuf.generated.AuthenticationProtos.Token
toToken
(org.apache.hadoop.security.token.Token<AuthenticationTokenIdentifier> token) Converts a Token instance (with embedded identifier) to the protobuf representation.
-
Field Details
-
LOG
-
injectedException
-
-
Constructor Details
-
ClientTokenUtil
private ClientTokenUtil()
-
-
Method Details
-
injectFault
- Throws:
com.google.protobuf.ServiceException
-
obtainToken
@Private public static org.apache.hadoop.security.token.Token<AuthenticationTokenIdentifier> obtainToken(Connection conn) throws IOException Obtain and return an authentication token for the current user.- Parameters:
conn
- The HBase cluster connection- Returns:
- the authentication token instance
- Throws:
IOException
- if a remote error or serialization problem occurs.
-
toToken
@Private static org.apache.hadoop.hbase.protobuf.generated.AuthenticationProtos.Token toToken(org.apache.hadoop.security.token.Token<AuthenticationTokenIdentifier> token) Converts a Token instance (with embedded identifier) to the protobuf representation.- Parameters:
token
- the Token instance to copy- Returns:
- the protobuf Token message
-
toToken
@Private static org.apache.hadoop.security.token.Token<AuthenticationTokenIdentifier> toToken(org.apache.hadoop.hbase.protobuf.generated.AuthenticationProtos.Token proto) Converts a protobuf Token message back into a Token instance.- Parameters:
proto
- the protobuf Token message- Returns:
- the Token instance
-
obtainToken
@Private static org.apache.hadoop.security.token.Token<AuthenticationTokenIdentifier> obtainToken(Connection conn, User user) throws IOException, InterruptedException Obtain and return an authentication token for the given user.- Parameters:
conn
- The HBase cluster connectionuser
- The user to obtain a token for- Returns:
- the authentication token instance
- Throws:
IOException
InterruptedException
-
obtainAndCacheToken
public static void obtainAndCacheToken(Connection conn, User user) throws IOException, InterruptedException Obtain an authentication token for the given user and add it to the user's credentials.- Parameters:
conn
- The HBase cluster connectionuser
- The user for whom to obtain the token- Throws:
IOException
- If making a remote call to the authentication service failsInterruptedException
- If executing as the given user is interrupted
-