public class OAuth2ProviderOperations extends Object
| Constructor and Description |
|---|
OAuth2ProviderOperations() |
| Modifier and Type | Method and Description |
|---|---|
void |
createClient(OAuth2ProviderConfiguration oAuth2ProviderConfiguration,
String clientId,
ClientType clientType,
String clientSecret,
String clientName,
String description,
String principal,
Set<String> redirectUris,
Set<Constants.RequestGrantType> authorizedGrantTypes,
Set<String> scopes,
boolean failIfPresent)
Creates a new client and saves it in the configured client store.
|
void |
deleteClient(OAuth2ProviderConfiguration oAuth2ProviderConfiguration,
String clientId)
Deletes a client from the store.
|
void |
revokeToken(OAuth2ProviderConfiguration oAuth2ProviderConfiguration,
String token)
Revokes an access token or refresh token, invalidating the related refresh token or access token as well.
|
org.mule.runtime.extension.api.runtime.operation.Result<String,Void> |
validateToken(OAuth2ProviderConfiguration oAuth2ProviderConfiguration,
org.mule.runtime.extension.api.security.AuthenticationHandler authenticationHandler,
String accessTokenToValidate,
Set<String> scopesToValidate,
Set<String> resourceOwnerRoles)
Checks that a valid access token is provided.
|
@Throws(value=ValidateTokenErrorProvider.class) @MediaType(value="application/json") public org.mule.runtime.extension.api.runtime.operation.Result<String,Void> validateToken(@Config OAuth2ProviderConfiguration oAuth2ProviderConfiguration, org.mule.runtime.extension.api.security.AuthenticationHandler authenticationHandler, @Expression(value=REQUIRED) @Optional(defaultValue="#[(attributes.headers[\'authorization\'] splitBy \' \')[1]]") @Alias(value="accessToken") String accessTokenToValidate, @Expression(value=REQUIRED) @Optional @NullSafe @Alias(value="scopes") Set<String> scopesToValidate, @Expression(value=REQUIRED) @Optional @NullSafe Set<String> resourceOwnerRoles) throws UnauthorizedTokenException
Checks that a valid access token is provided.
oAuth2ProviderConfiguration - The provider configurationaccessTokenToValidate - The token to evaluate or the expression to resolve in order to get the token valuescopesToValidate - The scopes to enforce when validating the tokenresourceOwnerRoles - The resource owner roles to enforce when validating the tokenUnauthorizedTokenException - if the token is not valid@Throws(value=CreateClientErrorProvider.class) public void createClient(@Config OAuth2ProviderConfiguration oAuth2ProviderConfiguration, @Expression(value=SUPPORTED) String clientId, @Expression(value=SUPPORTED) @Optional(defaultValue="PUBLIC") @Alias(value="type") ClientType clientType, @Expression(value=SUPPORTED) @Optional @Alias(value="secret") String clientSecret, @Expression(value=SUPPORTED) @Optional String clientName, @Expression(value=SUPPORTED) @Optional String description, @Expression(value=SUPPORTED) @Optional String principal, @Expression(value=REQUIRED) @Optional @NullSafe Set<String> redirectUris, @Expression(value=REQUIRED) @Optional @NullSafe Set<Constants.RequestGrantType> authorizedGrantTypes, @Expression(value=REQUIRED) @Optional @NullSafe Set<String> scopes, @Expression(value=NOT_SUPPORTED) @Optional(defaultValue="false") boolean failIfPresent) throws ClientAlreadyExistsException, OAuth2ConfigurationException
clientId - the Client IdclientSecret - the Client secretclientType - Clients can be PUBLIC or CONFIDENTIAL. If Confidential the secret is required. By default Clients are PUBLICclientName - a friendly name for the Clientdescription - a brief description of the Clientprincipal - An optional principal to use when the ID can't be used with the security providerredirectUris - a list with the Client's valid redirect urisauthorizedGrantTypes - the Client's supported grant typesscopes - the Client's supported scopesfailIfPresent - boolean to indicate if the operation should fail when the client id is already used.
Otherwise it should override the infotmation for the registered clientClientAlreadyExistsExceptionOAuth2ConfigurationException@Throws(value=DeleteClientErrorProvider.class) public void deleteClient(@Config OAuth2ProviderConfiguration oAuth2ProviderConfiguration, @Expression(value=SUPPORTED) String clientId) throws NoSuchClientException
Deletes a client from the store.
clientId - the Client IdNoSuchClientException - If the client does not exist@Throws(value=RevokeTokenErrorProvider.class) public void revokeToken(@Config OAuth2ProviderConfiguration oAuth2ProviderConfiguration, @Expression(value=SUPPORTED) String token) throws InvalidTokenException
Revokes an access token or refresh token, invalidating the related refresh token or access token as well. If client credentials need to be validated the validateClient credential should be used before.
oAuth2ProviderConfiguration - this provider configurationtoken - the token to revoke, it can be an access token or a refresh tokenInvalidTokenException - if the token is not validCopyright © 2019 MuleSoft, Inc.. All rights reserved.