Interface OAuth2TokenService
- All Known Implementing Classes:
AbstractOAuth2TokenService,DefaultOAuth2TokenService,XsuaaOAuth2TokenService
public interface OAuth2TokenService
Retrieves OAuth2 Access Tokens as documented here: https://docs.cloudfoundry.org/api/uaa/version/4.31.0/index.html#token
-
Method Summary
Modifier and TypeMethodDescriptionretrieveAccessTokenViaClientCredentialsGrant(URI tokenEndpointUri, ClientIdentity clientIdentity, String zoneId, String subdomain, Map<String, String> optionalParameters, boolean disableCacheForRequest) Requests access token from OAuth Server with client credentials.retrieveAccessTokenViaJwtBearerTokenGrant(URI tokenEndpointUri, ClientIdentity clientIdentity, String token, String subdomain, Map<String, String> optionalParameters, boolean disableCacheForRequest) retrieveAccessTokenViaJwtBearerTokenGrant(URI tokenEndpointUri, ClientIdentity clientIdentity, String token, Map<String, String> optionalParameters, boolean disableCache, String xZid) retrieveAccessTokenViaPasswordGrant(URI tokenEndpointUri, ClientIdentity clientIdentity, String username, String password, String subdomain, Map<String, String> optionalParameters, boolean disableCacheForRequest) Requests access token from OAuth Server with user / password.retrieveAccessTokenViaRefreshToken(URI tokenEndpointUri, ClientIdentity clientIdentity, String refreshToken, String subdomain, boolean disableCacheForRequest) Requests access token from OAuth Server with refresh-token.
-
Method Details
-
retrieveAccessTokenViaClientCredentialsGrant
OAuth2TokenResponse retrieveAccessTokenViaClientCredentialsGrant(@Nonnull URI tokenEndpointUri, @Nonnull ClientIdentity clientIdentity, @Nullable String zoneId, @Nullable String subdomain, @Nullable Map<String, String> optionalParameters, boolean disableCacheForRequest) throws OAuth2ServiceExceptionRequests access token from OAuth Server with client credentials.- Parameters:
tokenEndpointUri- the token endpoint URI.clientIdentity- the client identity of the OAuth client, the recipient of the token.zoneId- Zone identifier - tenant discriminatorsubdomain- optionally indicates what Identity Zone this request goes to by supplying a subdomain (tenant).optionalParameters- optional request parameters, can be null.disableCacheForRequest- set to true disables the token cache for this request.- Returns:
- the OAuth2AccessToken.
- Throws:
OAuth2ServiceException- in case of an error during the http request.
-
retrieveAccessTokenViaRefreshToken
OAuth2TokenResponse retrieveAccessTokenViaRefreshToken(URI tokenEndpointUri, ClientIdentity clientIdentity, String refreshToken, @Nullable String subdomain, boolean disableCacheForRequest) throws OAuth2ServiceException Requests access token from OAuth Server with refresh-token.- Parameters:
tokenEndpointUri- the token endpoint URI.clientIdentity- the client identity of the OAuth client, the recipient of the token.refreshToken- the refresh token that was returned along with the access token {link #OAuth2AccessToken}.subdomain- optionally indicates what Identity Zone this request goes to by supplying a subdomain (tenant).disableCacheForRequest- set to true disables the token cache for this request.- Returns:
- the OAuth2AccessToken
- Throws:
OAuth2ServiceException- in case of an error during the http request.
-
retrieveAccessTokenViaPasswordGrant
OAuth2TokenResponse retrieveAccessTokenViaPasswordGrant(URI tokenEndpointUri, ClientIdentity clientIdentity, String username, String password, @Nullable String subdomain, @Nullable Map<String, String> optionalParameters, boolean disableCacheForRequest) throws OAuth2ServiceExceptionRequests access token from OAuth Server with user / password.- Parameters:
tokenEndpointUri- the token endpoint URI.clientIdentity- the client identity of the OAuth client, the recipient of the token.username- the username for the user trying to get a tokenpassword- the password for the user trying to get a tokensubdomain- optionally indicates what Identity Zone this request goes to by supplying a subdomain (tenant).optionalParameters- optional request parameters, can be null.disableCacheForRequest- set to true disables the token cache for this request.- Returns:
- the OAuth2AccessToken
- Throws:
OAuth2ServiceException- in case of an error during the http request.
-
retrieveAccessTokenViaJwtBearerTokenGrant
OAuth2TokenResponse retrieveAccessTokenViaJwtBearerTokenGrant(URI tokenEndpointUri, ClientIdentity clientIdentity, String token, @Nullable String subdomain, @Nullable Map<String, String> optionalParameters, boolean disableCacheForRequest) throws OAuth2ServiceException- Parameters:
tokenEndpointUri- the token endpoint URI.clientIdentity- the client identity of the OAuth client, the recipient of the token.token- the JWT token identifying representing the user to be authenticatedsubdomain- optionally indicates what Identity Zone this request goes to by supplying a subdomain (tenant).optionalParameters- optional request parameters, can be null.disableCacheForRequest- set to true disables the token cache for this request.- Returns:
- the OAuth2AccessToken
- Throws:
OAuth2ServiceException- in case of an error during the http request.
-
retrieveAccessTokenViaJwtBearerTokenGrant
OAuth2TokenResponse retrieveAccessTokenViaJwtBearerTokenGrant(URI tokenEndpointUri, ClientIdentity clientIdentity, @Nonnull String token, @Nullable Map<String, String> optionalParameters, boolean disableCache, @Nonnull String xZid) throws OAuth2ServiceException- Parameters:
tokenEndpointUri- the token endpoint URI.clientIdentity- the client identity of the OAuth client, the recipient of the token.token- the JWT token identifying representing the user to be authenticatedoptionalParameters- optional request parameters, can be null.disableCache- setting to true disables the token cache for this request.xZid- zone id of the tenant- Returns:
- the OAuth2AccessToken
- Throws:
OAuth2ServiceException- in case of an error during the http request.
-