public class AuthenticationContext extends Object
| Constructor and Description |
|---|
AuthenticationContext(String authority,
boolean validateAuthority,
ExecutorService service)
Constructor to create the context with the address of the authority.
|
| Modifier and Type | Method and Description |
|---|---|
Future<AuthenticationResult> |
acquireToken(String resource,
AsymmetricKeyCredential credential,
AuthenticationCallback callback)
Acquires security token from the authority.
|
Future<AuthenticationResult> |
acquireToken(String resource,
ClientAssertion credential,
AuthenticationCallback callback)
Acquires security token from the authority.
|
Future<AuthenticationResult> |
acquireToken(String resource,
ClientAssertion assertion,
ClientCredential credential,
AuthenticationCallback callback)
Acquires an access token from the authority on behalf of a user.
|
Future<AuthenticationResult> |
acquireToken(String resource,
ClientCredential credential,
AuthenticationCallback callback)
Acquires security token from the authority.
|
Future<AuthenticationResult> |
acquireToken(String resource,
String clientId,
String username,
String password,
AuthenticationCallback callback)
Acquires a security token from the authority using a Refresh Token
previously received.
|
Future<AuthenticationResult> |
acquireTokenByAuthorizationCode(String authorizationCode,
String resource,
String clientId,
URI redirectUri,
AuthenticationCallback callback)
Acquires security token from the authority using an authorization code
previously received.
|
Future<AuthenticationResult> |
acquireTokenByAuthorizationCode(String authorizationCode,
URI redirectUri,
AsymmetricKeyCredential credential,
AuthenticationCallback callback)
Acquires security token from the authority using an authorization code
previously received.
|
Future<AuthenticationResult> |
acquireTokenByAuthorizationCode(String authorizationCode,
URI redirectUri,
AsymmetricKeyCredential credential,
String resource,
AuthenticationCallback callback)
Acquires security token from the authority using an authorization code
previously received.
|
Future<AuthenticationResult> |
acquireTokenByAuthorizationCode(String authorizationCode,
URI redirectUri,
ClientAssertion credential,
AuthenticationCallback callback)
Acquires security token from the authority using an authorization code
previously received.
|
Future<AuthenticationResult> |
acquireTokenByAuthorizationCode(String authorizationCode,
URI redirectUri,
ClientAssertion credential,
String resource,
AuthenticationCallback callback)
Acquires security token from the authority using an authorization code
previously received.
|
Future<AuthenticationResult> |
acquireTokenByAuthorizationCode(String authorizationCode,
URI redirectUri,
ClientCredential credential,
AuthenticationCallback callback)
Acquires security token from the authority using an authorization code
previously received.
|
Future<AuthenticationResult> |
acquireTokenByAuthorizationCode(String authorizationCode,
URI redirectUri,
ClientCredential credential,
String resource,
AuthenticationCallback callback)
Acquires security token from the authority using an authorization code
previously received.
|
Future<AuthenticationResult> |
acquireTokenByRefreshToken(String refreshToken,
AsymmetricKeyCredential credential,
AuthenticationCallback callback)
Acquires a security token from the authority using a Refresh Token
previously received.
|
Future<AuthenticationResult> |
acquireTokenByRefreshToken(String refreshToken,
AsymmetricKeyCredential credential,
String resource,
AuthenticationCallback callback)
Acquires a security token from the authority using a Refresh Token
previously received.
|
Future<AuthenticationResult> |
acquireTokenByRefreshToken(String refreshToken,
ClientCredential credential,
AuthenticationCallback callback)
Acquires a security token from the authority using a Refresh Token
previously received.
|
Future<AuthenticationResult> |
acquireTokenByRefreshToken(String refreshToken,
ClientCredential credential,
String resource,
AuthenticationCallback callback)
Acquires a security token from the authority using a Refresh Token
previously received.
|
Future<AuthenticationResult> |
acquireTokenByRefreshToken(String refreshToken,
String clientId,
ClientAssertion credential,
AuthenticationCallback callback)
Acquires a security token from the authority using a Refresh Token
previously received.
|
Future<AuthenticationResult> |
acquireTokenByRefreshToken(String refreshToken,
String clientId,
ClientAssertion credential,
String resource,
AuthenticationCallback callback)
Acquires a security token from the authority using a Refresh Token
previously received.
|
String |
getAuthority()
Authority associated with the context instance
|
String |
getCorrelationId()
Returns the correlation id configured by the user.
|
Proxy |
getProxy()
Returns Proxy configuration
|
SSLSocketFactory |
getSslSocketFactory()
Returns SSLSocketFactory configuration object.
|
void |
setCorrelationId(String correlationId)
Set optional correlation id to be used by the API.
|
void |
setProxy(Proxy proxy)
Sets Proxy configuration to be used by the context for all network
communication.
|
void |
setSslSocketFactory(SSLSocketFactory sslSocketFactory)
Sets SSLSocketFactory object to be used by the context.
|
boolean |
shouldValidateAuthority()
Returns validateAuthority boolean value passed as a constructor
parameter.
|
public AuthenticationContext(String authority, boolean validateAuthority, ExecutorService service) throws MalformedURLException
authority - URL of the authenticating authorityvalidateAuthority - flag to enable/disable authority validation.service - ExecutorService to be used to execute the requests. Developer
is responsible for maintaining the lifetime of the
ExecutorService.MalformedURLException - thrown if URL is invalidpublic Proxy getProxy()
public void setProxy(Proxy proxy)
proxy - Proxy configuration objectpublic SSLSocketFactory getSslSocketFactory()
public void setSslSocketFactory(SSLSocketFactory sslSocketFactory)
sslSocketFactory - public Future<AuthenticationResult> acquireToken(String resource, String clientId, String username, String password, AuthenticationCallback callback)
clientId - Name or ID of the client requesting the token.resource - Identifier of the target resource that is the recipient of the
requested token. If null, token is requested for the same
resource refresh token was originally issued for. If passed,
resource should match the original resource used to acquire
refresh token unless token service supports refresh token for
multiple resources.username - Username of the managed or federated user.password - Password of the managed or federated user.callback - optional callback object for non-blocking execution.Future object representing the
AuthenticationResult of the call. It contains Access
Token, Refresh Token and the Access Token's expiration time.public Future<AuthenticationResult> acquireToken(String resource, ClientAssertion credential, AuthenticationCallback callback)
resource - Identifier of the target resource that is the recipient of the
requested token.credential - The client assertion to use for token acquisition.callback - optional callback object for non-blocking execution.Future object representing the
AuthenticationResult of the call. It contains Access
Token and the Access Token's expiration time. Refresh Token
property will be null for this overload.public Future<AuthenticationResult> acquireToken(String resource, ClientAssertion assertion, ClientCredential credential, AuthenticationCallback callback)
resource - Identifier of the target resource that is the recipient of the
requested token.assertion - The access token to use for token acquisition.credential - The client credential to use for token acquisition.callback - optional callback object for non-blocking execution.Future object representing the
AuthenticationResult of the call. It contains Access
Token and the Access Token's expiration time. Refresh Token
property will be null for this overload.AuthenticationExceptionpublic Future<AuthenticationResult> acquireToken(String resource, ClientCredential credential, AuthenticationCallback callback)
resource - Identifier of the target resource that is the recipient of the
requested token.credential - The client credential to use for token acquisition.callback - optional callback object for non-blocking execution.Future object representing the
AuthenticationResult of the call. It contains Access
Token and the Access Token's expiration time. Refresh Token
property will be null for this overload.public Future<AuthenticationResult> acquireToken(String resource, AsymmetricKeyCredential credential, AuthenticationCallback callback) throws AuthenticationException
resource - Identifier of the target resource that is the recipient of the
requested token.credential - object representing Private Key to use for token acquisition.callback - optional callback object for non-blocking execution.Future object representing the
AuthenticationResult of the call. It contains Access
Token and the Access Token's expiration time. Refresh Token
property will be null for this overload.AuthenticationExceptionpublic Future<AuthenticationResult> acquireTokenByAuthorizationCode(String authorizationCode, String resource, String clientId, URI redirectUri, AuthenticationCallback callback)
authorizationCode - The authorization code received from service authorizationresource - Identifier of the target resource that is the recipient of the
requested token.clientId - The client assertion to use for token acquisition endpoint.redirectUri - The redirect address used for obtaining authorization code.callback - optional callback object for non-blocking execution.Future object representing the
AuthenticationResult of the call. It contains Access
Token, Refresh Token and the Access Token's expiration time.public Future<AuthenticationResult> acquireTokenByAuthorizationCode(String authorizationCode, URI redirectUri, ClientAssertion credential, AuthenticationCallback callback)
authorizationCode - The authorization code received from service authorization
endpoint.redirectUri - The redirect address used for obtaining authorization code.credential - The client assertion to use for token acquisition.callback - optional callback object for non-blocking execution.Future object representing the
AuthenticationResult of the call. It contains Access
Token, Refresh Token and the Access Token's expiration time.public Future<AuthenticationResult> acquireTokenByAuthorizationCode(String authorizationCode, URI redirectUri, ClientAssertion credential, String resource, AuthenticationCallback callback)
authorizationCode - The authorization code received from service authorization
endpoint.redirectUri - The redirect address used for obtaining authorization code.credential - The client assertion to use for token acquisition.resource - Identifier of the target resource that is the recipient of the
requested token. It can be null if provided earlier to acquire
authorizationCode.callback - optional callback object for non-blocking execution.Future object representing the
AuthenticationResult of the call. It contains Access
Token, Refresh Token and the Access Token's expiration time.public Future<AuthenticationResult> acquireTokenByAuthorizationCode(String authorizationCode, URI redirectUri, ClientCredential credential, AuthenticationCallback callback)
authorizationCode - The authorization code received from service authorization
endpoint.redirectUri - The redirect address used for obtaining authorization code.credential - The client credential to use for token acquisition.callback - optional callback object for non-blocking execution.Future object representing the
AuthenticationResult of the call. It contains Access
Token, Refresh Token and the Access Token's expiration time.public Future<AuthenticationResult> acquireTokenByAuthorizationCode(String authorizationCode, URI redirectUri, ClientCredential credential, String resource, AuthenticationCallback callback)
authorizationCode - The authorization code received from service authorization
endpoint.redirectUri - The redirect address used for obtaining authorization code.credential - The client credential to use for token acquisition.resource - Identifier of the target resource that is the recipient of the
requested token. It can be null if provided earlier to acquire
authorizationCode.callback - optional callback object for non-blocking execution.Future object representing the
AuthenticationResult of the call. It contains Access
Token, Refresh Token and the Access Token's expiration time.public Future<AuthenticationResult> acquireTokenByAuthorizationCode(String authorizationCode, URI redirectUri, AsymmetricKeyCredential credential, AuthenticationCallback callback) throws AuthenticationException
authorizationCode - The authorization code received from service authorization
endpoint.redirectUri - The redirect address used for obtaining authorization code.credential - object representing Private Key to use for token acquisition.callback - optional callback object for non-blocking execution.Future object representing the
AuthenticationResult of the call. It contains Access
Token, Refresh Token and the Access Token's expiration time.AuthenticationException - thrown if AsymmetricKeyCredential fails to sign the
JWT token.public Future<AuthenticationResult> acquireTokenByAuthorizationCode(String authorizationCode, URI redirectUri, AsymmetricKeyCredential credential, String resource, AuthenticationCallback callback) throws AuthenticationException
authorizationCode - The authorization code received from service authorization
endpoint.redirectUri - The redirect address used for obtaining authorization code.credential - object representing Private Key to use for token acquisition.resource - Identifier of the target resource that is the recipient of the
requested token. It can be null if provided earlier to acquire
authorizationCode.callback - optional callback object for non-blocking execution.Future object representing the
AuthenticationResult of the call. It contains Access
Token, Refresh Token and the Access Token's expiration time.AuthenticationException - thrown if AsymmetricKeyCredential fails to sign the
JWT token.public Future<AuthenticationResult> acquireTokenByRefreshToken(String refreshToken, String clientId, ClientAssertion credential, AuthenticationCallback callback)
refreshToken - Refresh Token to use in the refresh flow.clientId - Name or ID of the client requesting the token.credential - The client assertion used for token acquisition.callback - optional callback object for non-blocking execution.Future object representing the
AuthenticationResult of the call. It contains Access
Token, Refresh Token and the Access Token's expiration time.public Future<AuthenticationResult> acquireTokenByRefreshToken(String refreshToken, String clientId, ClientAssertion credential, String resource, AuthenticationCallback callback)
refreshToken - Refresh Token to use in the refresh flow.clientId - Name or ID of the client requesting the token.credential - The client assertion used for token acquisition.resource - Identifier of the target resource that is the recipient of the
requested token. If null, token is requested for the same
resource refresh token was originally issued for. If passed,
resource should match the original resource used to acquire
refresh token unless token service supports refresh token for
multiple resources.callback - optional callback object for non-blocking execution.Future object representing the
AuthenticationResult of the call. It contains Access
Token, Refresh Token and the Access Token's expiration time.public Future<AuthenticationResult> acquireTokenByRefreshToken(String refreshToken, ClientCredential credential, AuthenticationCallback callback)
refreshToken - Refresh Token to use in the refresh flow.credential - The client credential used for token acquisition.callback - optional callback object for non-blocking execution.Future object representing the
AuthenticationResult of the call. It contains Access
Token, Refresh Token and the Access Token's expiration time.public Future<AuthenticationResult> acquireTokenByRefreshToken(String refreshToken, ClientCredential credential, String resource, AuthenticationCallback callback)
refreshToken - Refresh Token to use in the refresh flow.credential - The client credential used for token acquisition.resource - Identifier of the target resource that is the recipient of the
requested token. If null, token is requested for the same
resource refresh token was originally issued for. If passed,
resource should match the original resource used to acquire
refresh token unless token service supports refresh token for
multiple resources.callback - optional callback object for non-blocking execution.Future object representing the
AuthenticationResult of the call. It contains Access
Token, Refresh Token and the Access Token's expiration time.public Future<AuthenticationResult> acquireTokenByRefreshToken(String refreshToken, AsymmetricKeyCredential credential, AuthenticationCallback callback) throws AuthenticationException
refreshToken - Refresh Token to use in the refresh flow.credential - object representing Private Key to use for token acquisition.callback - optional callback object for non-blocking execution.Future object representing the
AuthenticationResult of the call. It contains Access
Token, Refresh Token and the Access Token's expiration time.AuthenticationException - thrown if AsymmetricKeyCredential fails to sign the
JWT token.public Future<AuthenticationResult> acquireTokenByRefreshToken(String refreshToken, AsymmetricKeyCredential credential, String resource, AuthenticationCallback callback) throws AuthenticationException
refreshToken - Refresh Token to use in the refresh flow.credential - object representing Private Key to use for token acquisition.resource - Identifier of the target resource that is the recipient of the
requested token. If null, token is requested for the same
resource refresh token was originally issued for. If passed,
resource should match the original resource used to acquire
refresh token unless token service supports refresh token for
multiple resources.callback - optional callback object for non-blocking execution.Future object representing the
AuthenticationResult of the call. It contains Access
Token, Refresh Token and the Access Token's expiration time.AuthenticationException - thrown if AsymmetricKeyCredential fails to sign the
JWT token.public String getCorrelationId()
public void setCorrelationId(String correlationId)
correlationId - String valuepublic boolean shouldValidateAuthority()
public String getAuthority()
Copyright © 2013–2015. All rights reserved.