Class OAuth2Interceptor
-
- All Implemented Interfaces:
-
okhttp3.Interceptor
public final class OAuth2Interceptor implements Interceptor
This class implements a okhttp3.Interceptor which enables OAuth authentication.
-
-
Field Summary
Fields Modifier and Type Field Description private final volatile Call
authenticatingCall
private final OAuth2Processor
oauth2Processor
private final OAuth2TokenStore
tokenStore
-
Constructor Summary
Constructors Constructor Description OAuth2Interceptor(OAuth2Processor oauth2Processor, OAuth2TokenStore tokenStore)
OAuth2Interceptor(OAuth2Processor oauth2Processor)
-
Method Summary
Modifier and Type Method Description final Call
getAuthenticatingCall()
Gets the Call that is currently being authenticated. final OAuth2Processor
getOauth2Processor()
final OAuth2TokenStore
getTokenStore()
Response
intercept(Interceptor.Chain chain)
final Collection<Call>
getQueuedCalls()
Gets an unmodifiable collection containing all the Calls that are queued up for authentication. final OAuth2Interceptor
cloneSilent()
Generates a silent clone of the current interceptor. -
-
Constructor Detail
-
OAuth2Interceptor
OAuth2Interceptor(OAuth2Processor oauth2Processor, OAuth2TokenStore tokenStore)
-
OAuth2Interceptor
OAuth2Interceptor(OAuth2Processor oauth2Processor)
-
-
Method Detail
-
getAuthenticatingCall
final Call getAuthenticatingCall()
Gets the Call that is currently being authenticated.
- Returns:
The Call that is currently being authenticated.
-
getOauth2Processor
final OAuth2Processor getOauth2Processor()
-
getTokenStore
final OAuth2TokenStore getTokenStore()
-
intercept
Response intercept(Interceptor.Chain chain)
-
getQueuedCalls
final Collection<Call> getQueuedCalls()
Gets an unmodifiable collection containing all the Calls that are queued up for authentication. Note that the authentication flow will only be re-run for Calls in the collection if authentication fails for the Call currently being authenticated. Calls in the collection may be cancelled. Authentication will not be done for a queued Call that has been cancelled.
- Returns:
An unmodifiable collection containing the Calls awaiting authentication.
-
cloneSilent
final OAuth2Interceptor cloneSilent()
Generates a silent clone of the current interceptor. For 'silent' interceptor, when the refresh token expires, it will not bring up the WebView or CCT automatically to authenticate and refresh the token.
-
-
-
-