Class OAuth2Processor
-
- All Implemented Interfaces:
public abstract class OAuth2Processor
This class is used by OAuth2Interceptor to authenticate when it detects an OAuth challenge.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public final class
OAuth2Processor.Tag
-
Field Summary
Fields Modifier and Type Field Description private String
responseType
private String
scope
private String
state
private String
secret
private Boolean
isRequestReadonlyToken
private Boolean
enablePKCE
-
Constructor Summary
Constructors Constructor Description OAuth2Processor(OAuth2Configuration oauth2Configuration)
OAuth2Processor(OAuth2Configuration oauth2Configuration, OkHttpClient client)
OAuth2Processor(OAuthConfig oAuthConfig)
Constructs a new OAuth2Processor. OAuth2Processor(OAuthConfig oAuthConfig, AbstractOAuthClient oAuthClient, OkHttpClient client)
Constructs a new OAuth2Processor with designated AbstractOAuthClient and OkHttpClient.
-
Method Summary
Modifier and Type Method Description final String
getResponseType()
final Unit
setResponseType(String responseType)
final String
getScope()
final Unit
setScope(String scope)
final String
getState()
final Unit
setState(String state)
final String
getSecret()
final Unit
setSecret(String secret)
final Boolean
isRequestReadonlyToken()
final Unit
setRequestReadonlyToken(Boolean isRequestReadonlyToken)
final Boolean
getEnablePKCE()
final Unit
setEnablePKCE(Boolean enablePKCE)
abstract OAuth2Token
authenticate()
Starts the OAuth 2.0 authentication process. abstract Unit
cancelAuthentication()
Cancels the ongoing authentication process. OAuth2Token
refresh(OAuth2Token token)
Refreshes the given OAuth 2.0 token. final Boolean
isAuthenticated(HttpUrl url)
Checks whether the request has session or not, this is called from OAuth2Interceptor to determine whether or not to add the bearer token in the header. -
-
Constructor Detail
-
OAuth2Processor
OAuth2Processor(OAuth2Configuration oauth2Configuration)
-
OAuth2Processor
OAuth2Processor(OAuth2Configuration oauth2Configuration, OkHttpClient client)
-
OAuth2Processor
OAuth2Processor(OAuthConfig oAuthConfig)
Constructs a new OAuth2Processor.- Parameters:
oAuthConfig
- the OAuth configuration
-
OAuth2Processor
OAuth2Processor(OAuthConfig oAuthConfig, AbstractOAuthClient oAuthClient, OkHttpClient client)
Constructs a new OAuth2Processor with designated AbstractOAuthClient and OkHttpClient.- Parameters:
oAuthConfig
- the OAuth configurationoAuthClient
- the AbstractOAuthClient used as OAuth credentialsclient
- the OkHttpClient used to make requests
-
-
Method Detail
-
getResponseType
final String getResponseType()
-
setResponseType
final Unit setResponseType(String responseType)
-
getScope
final String getScope()
-
setScope
final Unit setScope(String scope)
-
getState
final String getState()
-
setState
final Unit setState(String state)
-
getSecret
final String getSecret()
-
setSecret
final Unit setSecret(String secret)
-
isRequestReadonlyToken
final Boolean isRequestReadonlyToken()
-
setRequestReadonlyToken
final Unit setRequestReadonlyToken(Boolean isRequestReadonlyToken)
-
getEnablePKCE
final Boolean getEnablePKCE()
-
setEnablePKCE
final Unit setEnablePKCE(Boolean enablePKCE)
-
authenticate
abstract OAuth2Token authenticate()
Starts the OAuth 2.0 authentication process.
- Returns:
The obtained OAuth2Token if the process was successful, otherwise null.
-
cancelAuthentication
abstract Unit cancelAuthentication()
Cancels the ongoing authentication process. Does nothing if there was no ongoing authentication.
-
refresh
@WorkerThread() OAuth2Token refresh(OAuth2Token token)
Refreshes the given OAuth 2.0 token.
- Parameters:
token
- The OAuth2Token to be refreshed- Returns:
The refreshed OAuth2Token if the process was successful.
-
isAuthenticated
final Boolean isAuthenticated(HttpUrl url)
Checks whether the request has session or not, this is called from OAuth2Interceptor to determine whether or not to add the bearer token in the header.
-
-
-
-