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 org.apache.hbase.thirdparty.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 CompletableFuture<org.apache.hadoop.security.token.Token<AuthenticationTokenIdentifier>>
obtainToken
(AsyncConnection conn) Obtain and return an authentication token for the current user.(package private) 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.shaded.protobuf.generated.AuthenticationProtos.Token proto) Converts a protobuf Token message back into a Token instance.(package private) static org.apache.hadoop.hbase.shaded.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
private static void injectFault() throws org.apache.hbase.thirdparty.com.google.protobuf.ServiceException- Throws:
org.apache.hbase.thirdparty.com.google.protobuf.ServiceException
-
obtainToken
@Private public static CompletableFuture<org.apache.hadoop.security.token.Token<AuthenticationTokenIdentifier>> obtainToken(AsyncConnection conn) Obtain and return an authentication token for the current user.- Parameters:
conn
- The async HBase cluster connection- Returns:
- the authentication token instance, wrapped by a
CompletableFuture
.
-
obtainToken
@Private 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.shaded.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.shaded.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
-