Package org.apache.gravitino.client
Class KerberosTokenProvider
java.lang.Object
org.apache.gravitino.client.KerberosTokenProvider
- All Implemented Interfaces:
Closeable
,AutoCloseable
KerberosTokenProvider will get Kerberos token using GSS context negotiation and then provide the
access token for every request.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Builder class for configuring and creating instances of KerberosTokenProvider. -
Method Summary
Modifier and TypeMethodDescriptionbuilder()
Creates a new instance of the KerberosTokenProvider.Buildervoid
close()
Closes the KerberosTokenProvider and releases any underlying resources.byte[]
Acquire the data of token for authentication.boolean
Judge whether AuthDataProvider can provide token data.
-
Method Details
-
hasTokenData
public boolean hasTokenData()Judge whether AuthDataProvider can provide token data.- Returns:
- true if the AuthDataProvider can provide token data otherwise false.
-
getTokenData
public byte[] getTokenData()Acquire the data of token for authentication. The client will set the token data as HTTP header Authorization directly. So the return value should ensure token data contain the token header (eg: Bearer, Basic) if necessary.- Returns:
- the token data is used for authentication.
-
close
Closes the KerberosTokenProvider and releases any underlying resources.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Throws:
IOException
-
builder
Creates a new instance of the KerberosTokenProvider.Builder- Returns:
- A new instance of KerberosTokenProvider.Builder
-