public class DefaultBroadleafClientRegistrationRepository extends Object implements BroadleafClientRegistrationRepository
ClientRegistration
objects to the OAuth2 Client beans.
This class relies on the ContextHelperService
to get the current tenant id from request
attributes. This enables us to allow tenant tracking while preserving the
ClientRegistrationRepository
interface from the OAuth2 Client library.
This class has the ability to incorporate OAuthClientRegistrationWrapper
data built from
application properties. The OAuthClientRegistrationPersistenceService
will always be
checked first. If a registration is not found there then this will check the
ClientRegistrationPropertiesService
. If a registration is found with the
ClientRegistrationPropertiesService
, it will be saved with
OAuthClientRegistrationPersistenceService
.
Despite the name, this is not a repository in the usual sense. Its name is based on the Spring
interface ClientRegistrationRepository
that this class implements. Actual persistence
operations are handled by OAuthClientRegistrationPersistenceService
.Constructor and Description |
---|
DefaultBroadleafClientRegistrationRepository(OAuthClientRegistrationPersistenceService<OAuthClientRegistrationWrapper> clientRegistrationService,
ContextHelperService contextHelperService,
ClientRegistrationPropertiesService<OAuthClientRegistrationWrapper> clientRegistrationPropertiesService) |
Modifier and Type | Method and Description |
---|---|
protected org.springframework.security.oauth2.client.registration.ClientRegistration |
buildClientRegistration(OAuthClientRegistrationWrapper wrapper)
Converts an
OAuthClientRegistrationWrapper to a ClientRegistration . |
Map<String,OAuthClientRegistrationWrapper> |
findAllClientRegistrations()
Return a Map of all available 3rd party OAuth providers.
|
org.springframework.security.oauth2.client.registration.ClientRegistration |
findByRegistrationId(String registrationId)
Looks up a
ClientRegistration by its registration id. |
protected ClientRegistrationPropertiesService<OAuthClientRegistrationWrapper> |
getClientRegistrationPropertiesService() |
protected OAuthClientRegistrationPersistenceService<OAuthClientRegistrationWrapper> |
getClientRegistrationService() |
protected ContextHelperService |
getContextHelperService() |
protected OAuthClientRegistrationWrapper |
loadFromProperties(String registrationId,
String tenantId) |
public DefaultBroadleafClientRegistrationRepository(OAuthClientRegistrationPersistenceService<OAuthClientRegistrationWrapper> clientRegistrationService, ContextHelperService contextHelperService, ClientRegistrationPropertiesService<OAuthClientRegistrationWrapper> clientRegistrationPropertiesService)
@Nullable public org.springframework.security.oauth2.client.registration.ClientRegistration findByRegistrationId(String registrationId)
ClientRegistration
by its registration id. This will first check the
OAuthClientRegistrationPersistenceService
. If not found there, this will check
ClientRegistrationPropertiesService
.findByRegistrationId
in interface org.springframework.security.oauth2.client.registration.ClientRegistrationRepository
registrationId
- The registration id, e.g. "google" or "facebook".ClientRegistration
that corresponds to the given registration id.public Map<String,OAuthClientRegistrationWrapper> findAllClientRegistrations()
OAuthClientRegistrationWrapper
.findAllClientRegistrations
in interface BroadleafClientRegistrationRepository
OAuthClientRegistrationWrapper
protected OAuthClientRegistrationWrapper loadFromProperties(String registrationId, String tenantId)
@Nullable protected org.springframework.security.oauth2.client.registration.ClientRegistration buildClientRegistration(OAuthClientRegistrationWrapper wrapper)
OAuthClientRegistrationWrapper
to a ClientRegistration
. Returns
null if there are any exceptions in the conversion process.wrapper
- protected OAuthClientRegistrationPersistenceService<OAuthClientRegistrationWrapper> getClientRegistrationService()
protected ContextHelperService getContextHelperService()
protected ClientRegistrationPropertiesService<OAuthClientRegistrationWrapper> getClientRegistrationPropertiesService()
Copyright © 2021. All rights reserved.