public class SSOAuthenticator extends java.lang.Object implements Authenticator
Constructor and Description |
---|
SSOAuthenticator(java.lang.String clientId,
java.lang.String clientSecret,
java.lang.String scope,
java.lang.String redirectUri,
java.lang.String email,
java.lang.String identityProviderUri,
java.util.Map<java.lang.String,java.lang.String> queryItems)
Creates a new OAuth authentication strategy
|
Modifier and Type | Method and Description |
---|---|
void |
authorize(android.webkit.WebView view,
CompletionHandler<java.lang.Void> handler)
Brings up a web-based authorization view and directs the user through the OAuth process.
|
void |
deauthorize()
Deauthorizes the current user and clears any persistent state with regards to the current user.
|
void |
getToken(CompletionHandler<java.lang.String> handler)
Returns an access token of this authenticator.
|
boolean |
isAuthorized()
Returns True if the user is logically authorized.
|
void |
refreshToken(CompletionHandler<java.lang.String> handler)
Refresh an access token of this authenticator.
|
public SSOAuthenticator(@NonNull java.lang.String clientId, @NonNull java.lang.String clientSecret, @NonNull java.lang.String scope, @NonNull java.lang.String redirectUri, @NonNull java.lang.String email, @NonNull java.lang.String identityProviderUri, @Nullable java.util.Map<java.lang.String,java.lang.String> queryItems)
clientId
- the OAuth client idclientSecret
- the OAuth client secretscope
- space-separated string representing which permissions the application needsredirectUri
- the redirect URI that will be called when completing the authentication. This must match the redirect URI registered to your clientId.email
- The spark email address of the SSO user.identityProviderUri
- parameter identityProviderUri: the URI that will handle authentication claims with spark service on behalf of the hosting application.queryItems
- a collection of additional query items to be appended to the identityProviderUri.public boolean isAuthorized()
Authenticator
This may not mean the user has a valid access token yet, but the authentication strategy should be able to obtain one without further user interaction.
isAuthorized
in interface Authenticator
Authenticator
public void deauthorize()
Authenticator
Phone
is registered,
it should be deregistered before calling this method.deauthorize
in interface Authenticator
Authenticator
public void authorize(@NonNull android.webkit.WebView view, @NonNull CompletionHandler<java.lang.Void> handler)
view
- the web view for the authorization by the end user.handler
- the completion handler will be called when authentication is complete, the error to indicate if the authentication process was successful.public void getToken(CompletionHandler<java.lang.String> handler)
Authenticator
This may involve long-running operations such as service calls, but may also return immediately. The application should not make assumptions about how quickly this completes.
getToken
in interface Authenticator
handler
- a callback to be executed when completed, with the access token if successfuly retrieved, otherwise nil.Authenticator
public void refreshToken(CompletionHandler<java.lang.String> handler)
Authenticator
This may involve long-running operations such as service calls, but may also return immediately. The application should not make assumptions about how quickly this completes.
refreshToken
in interface Authenticator
handler
- a callback to be executed when completed, with the access token if successfuly retrieved, otherwise nil.