Class OAuth2ClientAuthTokenProviderService
java.lang.Object
com.flowable.core.spring.security.oauth2.client.OAuth2ClientAuthTokenProviderService
- All Implemented Interfaces:
AuthTokenProvider
Implementation of the
AuthTokenProvider
that uses the OAuth2AuthorizedClientService
to fetch an access
token for a clientRegistrationId.
Relies on the Spring security OAuth2 client registration machinery to lookup a client registration for a client registration id and to obtain access tokens.
- Author:
- Arthur Hupka-Merle
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final AuthorizedClientServiceOAuth2AuthorizedClientManager
protected final ClientRegistrationRepository
-
Constructor Summary
ConstructorsConstructorDescriptionOAuth2ClientAuthTokenProviderService
(ClientRegistrationRepository clientRegistrationRepository, OAuth2AuthorizedClientService authorizedClientService) -
Method Summary
Modifier and TypeMethodDescriptionboolean
canProvideAuthToken
(String externalServiceId) Should return true, when the provider can provide an access token for the given externalServiceId.getAuthToken
(String externalServiceId) Obtain access token for a client registration id.
-
Field Details
-
authorizedClientManager
-
clientRegistrationRepository
-
-
Constructor Details
-
OAuth2ClientAuthTokenProviderService
public OAuth2ClientAuthTokenProviderService(ClientRegistrationRepository clientRegistrationRepository, OAuth2AuthorizedClientService authorizedClientService)
-
-
Method Details
-
getAuthToken
Obtain access token for a client registration id.- Specified by:
getAuthToken
in interfaceAuthTokenProvider
- Parameters:
externalServiceId
- the client registration id to obtain the access token for- Returns:
- the JWT access token encoded as string.
-
canProvideAuthToken
Description copied from interface:AuthTokenProvider
Should return true, when the provider can provide an access token for the given externalServiceId.- Specified by:
canProvideAuthToken
in interfaceAuthTokenProvider
- Parameters:
externalServiceId
- the external service id- Returns:
- true, when the provider can provide an access token for the given service id
-