Package org.apache.iceberg.rest.auth
Class OAuth2Util.AuthSession
- java.lang.Object
-
- org.apache.iceberg.rest.auth.OAuth2Util.AuthSession
-
- Enclosing class:
- OAuth2Util
public static class OAuth2Util.AuthSession extends java.lang.Object
Class to handle authorization headers and token refresh.
-
-
Constructor Summary
Constructors Constructor Description AuthSession(java.util.Map<java.lang.String,java.lang.String> baseHeaders, java.lang.String token, java.lang.String tokenType)
Deprecated.will be removed in 1.3.0; useAuthSession(Map, String, String, String, String)
instead.AuthSession(java.util.Map<java.lang.String,java.lang.String> baseHeaders, java.lang.String token, java.lang.String tokenType, java.lang.String credential, java.lang.String scope)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
credential()
static OAuth2Util.AuthSession
empty()
A newOAuth2Util.AuthSession
with empty headers.java.lang.Long
expiresAtMillis()
static OAuth2Util.AuthSession
fromAccessToken(RESTClient client, java.util.concurrent.ScheduledExecutorService executor, java.lang.String token, java.lang.Long defaultExpiresAtMillis, OAuth2Util.AuthSession parent)
static OAuth2Util.AuthSession
fromCredential(RESTClient client, java.util.concurrent.ScheduledExecutorService executor, java.lang.String credential, OAuth2Util.AuthSession parent)
static OAuth2Util.AuthSession
fromTokenExchange(RESTClient client, java.util.concurrent.ScheduledExecutorService executor, java.lang.String token, java.lang.String tokenType, OAuth2Util.AuthSession parent)
static OAuth2Util.AuthSession
fromTokenResponse(RESTClient client, java.util.concurrent.ScheduledExecutorService executor, OAuthTokenResponse response, long startTimeMillis, OAuth2Util.AuthSession parent)
java.util.Map<java.lang.String,java.lang.String>
headers()
Pair<java.lang.Integer,java.util.concurrent.TimeUnit>
refresh(RESTClient client)
Attempt to refresh the session token using the token exchange flow.java.lang.String
scope()
void
stopRefreshing()
java.lang.String
token()
java.lang.String
tokenType()
-
-
-
Constructor Detail
-
AuthSession
@Deprecated public AuthSession(java.util.Map<java.lang.String,java.lang.String> baseHeaders, java.lang.String token, java.lang.String tokenType)
Deprecated.will be removed in 1.3.0; useAuthSession(Map, String, String, String, String)
instead.
-
AuthSession
public AuthSession(java.util.Map<java.lang.String,java.lang.String> baseHeaders, java.lang.String token, java.lang.String tokenType, java.lang.String credential, java.lang.String scope)
-
-
Method Detail
-
headers
public java.util.Map<java.lang.String,java.lang.String> headers()
-
token
public java.lang.String token()
-
tokenType
public java.lang.String tokenType()
-
expiresAtMillis
public java.lang.Long expiresAtMillis()
-
scope
public java.lang.String scope()
-
stopRefreshing
public void stopRefreshing()
-
credential
public java.lang.String credential()
-
empty
public static OAuth2Util.AuthSession empty()
A newOAuth2Util.AuthSession
with empty headers.- Returns:
- A new
OAuth2Util.AuthSession
with empty headers.
-
refresh
public Pair<java.lang.Integer,java.util.concurrent.TimeUnit> refresh(RESTClient client)
Attempt 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
-
fromAccessToken
public static OAuth2Util.AuthSession fromAccessToken(RESTClient client, java.util.concurrent.ScheduledExecutorService executor, java.lang.String token, java.lang.Long defaultExpiresAtMillis, OAuth2Util.AuthSession parent)
-
fromCredential
public static OAuth2Util.AuthSession fromCredential(RESTClient client, java.util.concurrent.ScheduledExecutorService executor, java.lang.String credential, OAuth2Util.AuthSession parent)
-
fromTokenResponse
public static OAuth2Util.AuthSession fromTokenResponse(RESTClient client, java.util.concurrent.ScheduledExecutorService executor, OAuthTokenResponse response, long startTimeMillis, OAuth2Util.AuthSession parent)
-
fromTokenExchange
public static OAuth2Util.AuthSession fromTokenExchange(RESTClient client, java.util.concurrent.ScheduledExecutorService executor, java.lang.String token, java.lang.String tokenType, OAuth2Util.AuthSession parent)
-
-