Class InMemoryOAuth2AuthorizedClientService
java.lang.Object
org.springframework.security.oauth2.client.InMemoryOAuth2AuthorizedClientService
- All Implemented Interfaces:
OAuth2AuthorizedClientService
public final class InMemoryOAuth2AuthorizedClientService
extends Object
implements OAuth2AuthorizedClientService
An
OAuth2AuthorizedClientService
that stores Authorized Client(s)
in-memory.-
Constructor Summary
ConstructorDescriptionInMemoryOAuth2AuthorizedClientService
(ClientRegistrationRepository clientRegistrationRepository) Constructs anInMemoryOAuth2AuthorizedClientService
using the provided parameters.InMemoryOAuth2AuthorizedClientService
(ClientRegistrationRepository clientRegistrationRepository, Map<OAuth2AuthorizedClientId, OAuth2AuthorizedClient> authorizedClients) Constructs anInMemoryOAuth2AuthorizedClientService
using the provided parameters. -
Method Summary
Modifier and TypeMethodDescription<T extends OAuth2AuthorizedClient>
TloadAuthorizedClient
(String clientRegistrationId, String principalName) Returns theOAuth2AuthorizedClient
associated to the provided client registration identifier and End-User'sPrincipal
name ornull
if not available.void
removeAuthorizedClient
(String clientRegistrationId, String principalName) Removes theOAuth2AuthorizedClient
associated to the provided client registration identifier and End-User'sPrincipal
name.void
saveAuthorizedClient
(OAuth2AuthorizedClient authorizedClient, Authentication principal) Saves theOAuth2AuthorizedClient
associating it to the provided End-UserAuthentication
(Resource Owner).
-
Constructor Details
-
InMemoryOAuth2AuthorizedClientService
public InMemoryOAuth2AuthorizedClientService(ClientRegistrationRepository clientRegistrationRepository) Constructs anInMemoryOAuth2AuthorizedClientService
using the provided parameters.- Parameters:
clientRegistrationRepository
- the repository of client registrations
-
InMemoryOAuth2AuthorizedClientService
public InMemoryOAuth2AuthorizedClientService(ClientRegistrationRepository clientRegistrationRepository, Map<OAuth2AuthorizedClientId, OAuth2AuthorizedClient> authorizedClients) Constructs anInMemoryOAuth2AuthorizedClientService
using the provided parameters.- Parameters:
clientRegistrationRepository
- the repository of client registrationsauthorizedClients
- the initialMap
of authorized client(s) keyed byOAuth2AuthorizedClientId
- Since:
- 5.2
-
-
Method Details
-
loadAuthorizedClient
public <T extends OAuth2AuthorizedClient> T loadAuthorizedClient(String clientRegistrationId, String principalName) Description copied from interface:OAuth2AuthorizedClientService
Returns theOAuth2AuthorizedClient
associated to the provided client registration identifier and End-User'sPrincipal
name ornull
if not available.- Specified by:
loadAuthorizedClient
in interfaceOAuth2AuthorizedClientService
- Type Parameters:
T
- a type of OAuth2AuthorizedClient- Parameters:
clientRegistrationId
- the identifier for the client's registrationprincipalName
- the name of the End-UserPrincipal
(Resource Owner)- Returns:
- the
OAuth2AuthorizedClient
ornull
if not available
-
saveAuthorizedClient
Description copied from interface:OAuth2AuthorizedClientService
Saves theOAuth2AuthorizedClient
associating it to the provided End-UserAuthentication
(Resource Owner).- Specified by:
saveAuthorizedClient
in interfaceOAuth2AuthorizedClientService
- Parameters:
authorizedClient
- the authorized clientprincipal
- the End-UserAuthentication
(Resource Owner)
-
removeAuthorizedClient
Description copied from interface:OAuth2AuthorizedClientService
Removes theOAuth2AuthorizedClient
associated to the provided client registration identifier and End-User'sPrincipal
name.- Specified by:
removeAuthorizedClient
in interfaceOAuth2AuthorizedClientService
- Parameters:
clientRegistrationId
- the identifier for the client's registrationprincipalName
- the name of the End-UserPrincipal
(Resource Owner)
-