public final class AuthorizationClientHelper extends Object
SampleAuthorizationClient
and SampleRefreshTokenUsage
for example usages.Modifier and Type | Method and Description |
---|---|
static AccessToken |
getAccessToken()
Authenticates the client with the Authorization Service, obtains an access token and returns it.
|
static AccessToken |
getAccessToken(List scopes)
Authenticates the client with the Authorization Service, obtains an access token and returns it; the client can request for specific
scopes during authentication by using the "scopes" parameter.
|
static AccessToken |
getAccessTokenForUser(ServletRequest servletRequest)
Authenticates the client (along with the user's auth code) with the Authorization Service, obtains an access token and returns it.
|
static AccessToken |
getAccessTokenForUser(String userName,
String userPassword)
Authenticates the client and the end user with the Authorization Service, obtains an access token and returns it.
|
static AccessToken |
getAccessTokenForUser(String userName,
String userPassword,
List scopes)
Authenticates the client and the end user with the Authorization Service, obtains an access token and returns it; the client can
request for specific scopes during authentication by using the "scopes" parameter.
|
static String |
getAuthorizationEndpoint(ServletRequest servletRequest)
Provides the Authorization Endpoint to which the client redirects the user-agent(browser) for getting an authorization code.
|
static String |
getAuthorizationEndpoint(ServletRequest servletRequest,
List scopes)
Provides the Authorization Endpoint to which the client redirects the user-agent(browser) for getting an authorization code.
|
static TokenAggregate |
getTokenAggregate()
Authenticates the client with the Authorization Service and obtains a token aggregate.
|
static TokenAggregate |
getTokenAggregate(List scopes)
Authenticates the client with the Authorization Service, obtains a token aggregate and returns it; the client can request for
specific scopes during authentication by using the "scopes" parameter.
|
static TokenAggregate |
getTokenAggregate(String refreshToken)
Authenticates the client with the Authorization Service, obtains a token aggregate using a refresh token and returns it.
|
static TokenAggregate |
getTokenAggregateForUser(ServletRequest servletRequest)
Authenticates the client (along with the user's auth code) with the Authorization Service, obtains a token aggregate and returns it.
|
static TokenAggregate |
getTokenAggregateForUser(String userName,
String userPassword)
Authenticates the client and the end user with the Authorization Service, obtains a token aggregate and returns it.
|
static TokenAggregate |
getTokenAggregateForUser(String userName,
String userPassword,
List scopes)
Authenticates the client and the end user with the Authorization Service, obtains an access token and returns it; the client can
request for specific scopes during authentication by using the "scopes" parameter.
|
static void |
shutdown()
Shuts down the helper library and releases any system resources associated with it.
|
public static AccessToken getAccessToken() throws AuthorizationHelperException, HttpResponseException
AccessToken
AuthorizationHelperException
- Indicates error conditions in the Authorization Helper APIs.HttpResponseException
- Indicates HTTP error responses propagated by the Authorization Helper APIs.public static TokenAggregate getTokenAggregate() throws AuthorizationHelperException, HttpResponseException
TokenAggregate
AuthorizationHelperException
- Indicates error conditions in the Authorization Helper APIs.HttpResponseException
- Indicates HTTP error responses propagated by the Authorization Helper APIs.public static AccessToken getAccessToken(List scopes) throws AuthorizationHelperException, HttpResponseException
scopes
- The list of scopes the client wants to specify while making the token request.AccessToken
AuthorizationHelperException
- Indicates error conditions in the Authorization Helper APIs.HttpResponseException
- Indicates HTTP error responses propagated by the Authorization Helper APIs.public static TokenAggregate getTokenAggregate(List scopes) throws AuthorizationHelperException, HttpResponseException
scopes
- The list of scopes the client wants to specify while making the token request.TokenAggregate
AuthorizationHelperException
- Indicates error conditions in the Authorization Helper APIs.HttpResponseException
- Indicates HTTP error responses propagated by the Authorization Helper APIs.public static AccessToken getAccessTokenForUser(ServletRequest servletRequest) throws AuthorizationHelperException, HttpResponseException
servletRequest
- This used to construct the Redirection URI which will be validated by the Authorization Service to ensure that the
redirection URI sent in auth code request and redirection URI in access token request are identical.AccessToken
AuthorizationHelperException
- Indicates error conditions in the Authorization Helper APIs.HttpResponseException
- Indicates HTTP error responses propagated by the Authorization Helper APIs.public static TokenAggregate getTokenAggregateForUser(ServletRequest servletRequest) throws AuthorizationHelperException, HttpResponseException
servletRequest
- This used to construct the Redirection URI which will be validated by the Authorization Service to ensure that the
redirection URI sent in auth code request and redirection URI in access token request are identical.TokenAggregate
AuthorizationHelperException
- Indicates error conditions in the Authorization Helper APIs.HttpResponseException
- Indicates HTTP error responses propagated by the Authorization Helper APIs.public static AccessToken getAccessTokenForUser(String userName, String userPassword) throws AuthorizationHelperException, HttpResponseException
userName
- The user name for whom the token is being requested.userPassword
- The user's password.AccessToken
AuthorizationHelperException
- Indicates error conditions in the Authorization Helper APIs.HttpResponseException
- Indicates HTTP error responses propagated by the Authorization Helper APIs.public static TokenAggregate getTokenAggregateForUser(String userName, String userPassword) throws AuthorizationHelperException, HttpResponseException
userName
- The user name for whom the token is being requested.userPassword
- The user's password.TokenAggregate
AuthorizationHelperException
- Indicates error conditions in the Authorization Helper APIs.HttpResponseException
- Indicates HTTP error responses propagated by the Authorization Helper APIs.public static AccessToken getAccessTokenForUser(String userName, String userPassword, List scopes) throws AuthorizationHelperException, HttpResponseException
userName
- The user name for whom the token is being requested.userPassword
- The user's password.scopes
- The list of scopes the client wants to specify while making the token request.AccessToken
AuthorizationHelperException
- Indicates error conditions in the Authorization Helper APIs.HttpResponseException
- Indicates HTTP error responses propagated by the Authorization Helper APIs.public static TokenAggregate getTokenAggregateForUser(String userName, String userPassword, List scopes) throws AuthorizationHelperException, HttpResponseException
userName
- The user name for whom the token is being requested.userPassword
- The user's password.scopes
- The list of scopes the client wants to specify while making the token request.AccessToken
AuthorizationHelperException
- Indicates error conditions in the Authorization Helper APIs.HttpResponseException
- Indicates HTTP error responses propagated by the Authorization Helper APIs.public static TokenAggregate getTokenAggregate(String refreshToken) throws AuthorizationHelperException, HttpResponseException
refreshToken
- A refresh token obtained previously by the client.TokenAggregate
AuthorizationHelperException
- Indicates error conditions in the Authorization Helper APIs.HttpResponseException
- Indicates HTTP error responses propagated by the Authorization Helper APIs.public static String getAuthorizationEndpoint(ServletRequest servletRequest) throws AuthorizationHelperException
servletRequest
- This used to construct the Client Redirection URI to which the Authorization Service would redirect the browser to, after
granting an authorization code to the user.AuthorizationHelperException
- Indicates error conditions in the Authorization Helper APIs.public static String getAuthorizationEndpoint(ServletRequest servletRequest, List scopes) throws AuthorizationHelperException
servletRequest
- This used to construct the Client Redirection URI to which the Authorization Service would redirect the browser to, after
granting an authorization code to the user.scopes
- The list of scopes the client wants to specify while making the token request. The access token will be associated with
the specific scopes being requested here only.AuthorizationHelperException
- Indicates error conditions in the Authorization Helper APIs.public static void shutdown()
Copyright © 2023 Avaya. All rights reserved.