public final class ExtensionsOAuthUtils extends Object
| Modifier and Type | Method and Description |
|---|---|
static Map<Field,String> |
getCallbackValuesExtractors(org.mule.runtime.api.meta.model.connection.ConnectionProviderModel providerModel)
Traverses the
providerModel looking for the Java fields annotated with OAuthCallbackValue. |
static OAuthConnectionProviderWrapper |
getOAuthConnectionProvider(ExecutionContextAdapter operationContext) |
static <C,T extends org.mule.runtime.extension.api.connectivity.oauth.OAuthState> |
getOAuthStateSetter(org.mule.runtime.api.connection.ConnectionProvider<C> connectionProvider,
Class<T> stateType,
org.mule.runtime.extension.api.connectivity.oauth.OAuthGrantType grantType)
|
static boolean |
refreshTokenIfNecessary(ExecutionContextAdapter<org.mule.runtime.api.meta.model.operation.OperationModel> operationContext,
Throwable e) |
static org.mule.runtime.extension.api.connectivity.oauth.AuthorizationCodeState |
toAuthorizationCodeState(AuthorizationCodeConfig config,
ResourceOwnerOAuthContext context) |
static ClientCredentialsLocation |
toCredentialsLocation(org.mule.runtime.extension.api.security.CredentialsPlacement placement) |
static <C> void |
updateOAuthParameters(org.mule.runtime.api.connection.ConnectionProvider<C> connectionProvider,
Map<Field,String> callbackValues,
ResourceOwnerOAuthContext context)
Updates the
connectionProvider state with the values from the given context. |
static <C> org.mule.runtime.api.connection.ConnectionValidationResult |
validateOAuthConnection(org.mule.runtime.api.connection.ConnectionProvider<C> connectionProvider,
C connection,
ResourceOwnerOAuthContext context)
Invokes
ConnectionProvider.validate(Object) on the connectionProvider only if the given context
returns a non null value for the ResourceOwnerOAuthContext.getAccessToken() method. |
public static org.mule.runtime.extension.api.connectivity.oauth.AuthorizationCodeState toAuthorizationCodeState(AuthorizationCodeConfig config, ResourceOwnerOAuthContext context)
public static ClientCredentialsLocation toCredentialsLocation(org.mule.runtime.extension.api.security.CredentialsPlacement placement)
public static OAuthConnectionProviderWrapper getOAuthConnectionProvider(ExecutionContextAdapter operationContext)
public static Map<Field,String> getCallbackValuesExtractors(org.mule.runtime.api.meta.model.connection.ConnectionProviderModel providerModel)
providerModel looking for the Java fields annotated with OAuthCallbackValue. Then returns
a Map in which the keys are the Field objects and the values are the expressions to be evaluated to obtain
the valuesproviderModel - an OAuth enabled ConnectionProviderModelMap with the value with fields and expressionspublic static <C,T extends org.mule.runtime.extension.api.connectivity.oauth.OAuthState> FieldSetter<org.mule.runtime.api.connection.ConnectionProvider<C>,T> getOAuthStateSetter(org.mule.runtime.api.connection.ConnectionProvider<C> connectionProvider, Class<T> stateType, org.mule.runtime.extension.api.connectivity.oauth.OAuthGrantType grantType)
C - the generic type of the connections generated by the delegateT - the generic type of the OAuthStateconnectionProvider - the ConnectionProvider in which the value is to be setstateType - the field's exact OAuthState typegrantType - the OAuthGrantType associated to the stateTypepublic static <C> void updateOAuthParameters(org.mule.runtime.api.connection.ConnectionProvider<C> connectionProvider,
Map<Field,String> callbackValues,
ResourceOwnerOAuthContext context)
connectionProvider state with the values from the given context. This includes not only
the provider's inner OAuthState but also the fields annotated with OAuthCallbackValueC - the generic type of the connections generated by the connectionProviderconnectionProvider - an OAuth enabled ConnectionProvidercallbackValues - a Map with OAuthCallbackValue annotated fields and the expressions
to be evaluated for each.context - a ResourceOwnerOAuthContextpublic static <C> org.mule.runtime.api.connection.ConnectionValidationResult validateOAuthConnection(org.mule.runtime.api.connection.ConnectionProvider<C> connectionProvider,
C connection,
ResourceOwnerOAuthContext context)
ConnectionProvider.validate(Object) on the connectionProvider only if the given context
returns a non null value for the ResourceOwnerOAuthContext.getAccessToken() method. A failure result is
returned otherwiseC - the connection's generic typeconnectionProvider - a ConnectionProviderconnection - a connection objectcontext - a ResourceOwnerOAuthContextConnectionValidationResultpublic static boolean refreshTokenIfNecessary(ExecutionContextAdapter<org.mule.runtime.api.meta.model.operation.OperationModel> operationContext, Throwable e)
Copyright © 2003–2020 MuleSoft, Inc.. All rights reserved.