Package org.apache.iceberg.rest.auth
Class OAuth2Util.AuthSession
java.lang.Object
org.apache.iceberg.rest.auth.OAuth2Util.AuthSession
- All Implemented Interfaces:
- AutoCloseable,- AuthSession
- Enclosing class:
- OAuth2Util
Class to handle authorization headers and token refresh.
- 
Field SummaryFields inherited from interface org.apache.iceberg.rest.auth.AuthSessionEMPTY
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionauthenticate(HTTPRequest request) Authenticates the given request and returns a new request with the necessary authentication.voidclose()Closes the session and releases any resources.config()static OAuth2Util.AuthSessionempty()A newOAuth2Util.AuthSessionwith empty headers.static OAuth2Util.AuthSessionfromAccessToken(RESTClient client, ScheduledExecutorService executor, String token, Long defaultExpiresAtMillis, OAuth2Util.AuthSession parent) static OAuth2Util.AuthSessionfromCredential(RESTClient client, ScheduledExecutorService executor, String credential, OAuth2Util.AuthSession parent) static OAuth2Util.AuthSessionfromTokenExchange(RESTClient client, ScheduledExecutorService executor, String token, String tokenType, OAuth2Util.AuthSession parent) static OAuth2Util.AuthSessionfromTokenResponse(RESTClient client, ScheduledExecutorService executor, OAuthTokenResponse response, long startTimeMillis, OAuth2Util.AuthSession parent) headers()refresh(RESTClient client) Attempt to refresh the session token using the token exchange flow.scope()voidtoken()
- 
Constructor Details- 
AuthSession
 
- 
- 
Method Details- 
authenticateDescription copied from interface:AuthSessionAuthenticates the given request and returns a new request with the necessary authentication.- Specified by:
- authenticatein interface- AuthSession
 
- 
headers
- 
token
- 
tokenType
- 
expiresAtMillis
- 
scope
- 
stopRefreshingpublic void stopRefreshing()
- 
closepublic void close()Description copied from interface:AuthSessionCloses the session and releases any resources. This method is called when the session is no longer needed. Note that since sessions may be cached, this method may not be called immediately after the session is no longer needed, but rather when the session is evicted from the cache, or the cache itself is closed.- Specified by:
- closein interface- AuthSession
- Specified by:
- closein interface- AutoCloseable
 
- 
credential
- 
oauth2ServerUri
- 
optionalOAuthParams
- 
config
- 
emptyA newOAuth2Util.AuthSessionwith empty headers.- Returns:
- A new OAuth2Util.AuthSessionwith empty headers.
 
- 
refreshAttempt to refresh the session token using the token exchange flow.- Parameters:
- client- a RESTClient
- Returns:
- interval to wait before calling refresh again, or null if no refresh is needed
 
- 
fromAccessTokenpublic static OAuth2Util.AuthSession fromAccessToken(RESTClient client, ScheduledExecutorService executor, String token, Long defaultExpiresAtMillis, OAuth2Util.AuthSession parent) 
- 
fromCredentialpublic static OAuth2Util.AuthSession fromCredential(RESTClient client, ScheduledExecutorService executor, String credential, OAuth2Util.AuthSession parent) 
- 
fromTokenResponsepublic static OAuth2Util.AuthSession fromTokenResponse(RESTClient client, ScheduledExecutorService executor, OAuthTokenResponse response, long startTimeMillis, OAuth2Util.AuthSession parent) 
- 
fromTokenExchangepublic static OAuth2Util.AuthSession fromTokenExchange(RESTClient client, ScheduledExecutorService executor, String token, String tokenType, OAuth2Util.AuthSession parent) 
 
-