Package io.tiledb.cloud.rest_api.auth
Class RetryingOAuth
- java.lang.Object
-
- io.tiledb.cloud.rest_api.auth.OAuth
-
- io.tiledb.cloud.rest_api.auth.RetryingOAuth
-
- All Implemented Interfaces:
Authentication
,okhttp3.Interceptor
public class RetryingOAuth extends OAuth implements okhttp3.Interceptor
-
-
Constructor Summary
Constructors Constructor Description RetryingOAuth(java.lang.String tokenUrl, java.lang.String clientId, OAuthFlow flow, java.lang.String clientSecret, java.util.Map<java.lang.String,java.lang.String> parameters)
RetryingOAuth(okhttp3.OkHttpClient client, org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder tokenRequestBuilder)
RetryingOAuth(org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder tokenRequestBuilder)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
applyToParams(java.util.List<Pair> queryParams, java.util.Map<java.lang.String,java.lang.String> headerParams, java.util.Map<java.lang.String,java.lang.String> cookieParams, java.lang.String payload, java.lang.String method, java.net.URI uri)
Apply authentication settings to header and query params.org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder
getTokenRequestBuilder()
Gets the token request builderokhttp3.Response
intercept(okhttp3.Interceptor.Chain chain)
void
setFlow(OAuthFlow flow)
Set the OAuth flowvoid
setTokenRequestBuilder(org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder tokenRequestBuilder)
Sets the token request builderboolean
updateAccessToken(java.lang.String requestAccessToken)
Returns true if the access token has been updated-
Methods inherited from class io.tiledb.cloud.rest_api.auth.OAuth
getAccessToken, setAccessToken
-
-
-
-
Constructor Detail
-
RetryingOAuth
public RetryingOAuth(okhttp3.OkHttpClient client, org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder tokenRequestBuilder)
- Parameters:
client
- An OkHttp clienttokenRequestBuilder
- A token request builder
-
RetryingOAuth
public RetryingOAuth(org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder tokenRequestBuilder)
- Parameters:
tokenRequestBuilder
- A token request builder
-
RetryingOAuth
public RetryingOAuth(java.lang.String tokenUrl, java.lang.String clientId, OAuthFlow flow, java.lang.String clientSecret, java.util.Map<java.lang.String,java.lang.String> parameters)
- Parameters:
tokenUrl
- The token URL to be used for this OAuth2 flow. Applicable to the following OAuth2 flows: "password", "clientCredentials" and "authorizationCode". The value must be an absolute URL.clientId
- The OAuth2 client ID for the "clientCredentials" flow.flow
- OAuth flow.clientSecret
- The OAuth2 client secret for the "clientCredentials" flow.parameters
- A map of string.
-
-
Method Detail
-
setFlow
public void setFlow(OAuthFlow flow)
Set the OAuth flow- Parameters:
flow
- The OAuth flow.
-
intercept
public okhttp3.Response intercept(okhttp3.Interceptor.Chain chain) throws java.io.IOException
- Specified by:
intercept
in interfaceokhttp3.Interceptor
- Throws:
java.io.IOException
-
updateAccessToken
public boolean updateAccessToken(java.lang.String requestAccessToken) throws java.io.IOException
Returns true if the access token has been updated- Parameters:
requestAccessToken
- the request access token- Returns:
- True if the update is successful
- Throws:
java.io.IOException
- If fail to update the access token
-
getTokenRequestBuilder
public org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder getTokenRequestBuilder()
Gets the token request builder- Returns:
- A token request builder
-
setTokenRequestBuilder
public void setTokenRequestBuilder(org.apache.oltu.oauth2.client.request.OAuthClientRequest.TokenRequestBuilder tokenRequestBuilder)
Sets the token request builder- Parameters:
tokenRequestBuilder
- Token request builder
-
applyToParams
public void applyToParams(java.util.List<Pair> queryParams, java.util.Map<java.lang.String,java.lang.String> headerParams, java.util.Map<java.lang.String,java.lang.String> cookieParams, java.lang.String payload, java.lang.String method, java.net.URI uri) throws ApiException
Description copied from interface:Authentication
Apply authentication settings to header and query params.- Specified by:
applyToParams
in interfaceAuthentication
- Overrides:
applyToParams
in classOAuth
- Parameters:
queryParams
- List of query parametersheaderParams
- Map of header parameterscookieParams
- Map of cookie parameterspayload
- HTTP request bodymethod
- HTTP methoduri
- URI- Throws:
ApiException
- if failed to update the parameters
-
-