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
ConstructorsConstructorDescriptionInMemoryOAuth2AuthorizedClientService(ClientRegistrationRepository clientRegistrationRepository) Constructs anInMemoryOAuth2AuthorizedClientServiceusing the provided parameters.InMemoryOAuth2AuthorizedClientService(ClientRegistrationRepository clientRegistrationRepository, Map<OAuth2AuthorizedClientId, OAuth2AuthorizedClient> authorizedClients) Constructs anInMemoryOAuth2AuthorizedClientServiceusing the provided parameters. -
Method Summary
Modifier and TypeMethodDescription<T extends OAuth2AuthorizedClient>
TloadAuthorizedClient(String clientRegistrationId, String principalName) Returns theOAuth2AuthorizedClientassociated to the provided client registration identifier and End-User'sPrincipalname ornullif not available.voidremoveAuthorizedClient(String clientRegistrationId, String principalName) Removes theOAuth2AuthorizedClientassociated to the provided client registration identifier and End-User'sPrincipalname.voidsaveAuthorizedClient(OAuth2AuthorizedClient authorizedClient, Authentication principal) Saves theOAuth2AuthorizedClientassociating it to the provided End-UserAuthentication(Resource Owner).
-
Constructor Details
-
InMemoryOAuth2AuthorizedClientService
public InMemoryOAuth2AuthorizedClientService(ClientRegistrationRepository clientRegistrationRepository) Constructs anInMemoryOAuth2AuthorizedClientServiceusing the provided parameters.- Parameters:
clientRegistrationRepository- the repository of client registrations
-
InMemoryOAuth2AuthorizedClientService
public InMemoryOAuth2AuthorizedClientService(ClientRegistrationRepository clientRegistrationRepository, Map<OAuth2AuthorizedClientId, OAuth2AuthorizedClient> authorizedClients) Constructs anInMemoryOAuth2AuthorizedClientServiceusing the provided parameters.- Parameters:
clientRegistrationRepository- the repository of client registrationsauthorizedClients- the initialMapof 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:OAuth2AuthorizedClientServiceReturns theOAuth2AuthorizedClientassociated to the provided client registration identifier and End-User'sPrincipalname ornullif not available.- Specified by:
loadAuthorizedClientin 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
OAuth2AuthorizedClientornullif not available
-
saveAuthorizedClient
Description copied from interface:OAuth2AuthorizedClientServiceSaves theOAuth2AuthorizedClientassociating it to the provided End-UserAuthentication(Resource Owner).- Specified by:
saveAuthorizedClientin interfaceOAuth2AuthorizedClientService- Parameters:
authorizedClient- the authorized clientprincipal- the End-UserAuthentication(Resource Owner)
-
removeAuthorizedClient
Description copied from interface:OAuth2AuthorizedClientServiceRemoves theOAuth2AuthorizedClientassociated to the provided client registration identifier and End-User'sPrincipalname.- Specified by:
removeAuthorizedClientin interfaceOAuth2AuthorizedClientService- Parameters:
clientRegistrationId- the identifier for the client's registrationprincipalName- the name of the End-UserPrincipal(Resource Owner)
-