Class InMemoryOAuth2AuthorizedClientService
- java.lang.Object
-
- org.springframework.security.oauth2.client.InMemoryOAuth2AuthorizedClientService
-
- All Implemented Interfaces:
OAuth2AuthorizedClientService
public final class InMemoryOAuth2AuthorizedClientService extends java.lang.Object implements OAuth2AuthorizedClientService
AnOAuth2AuthorizedClientServicethat storesAuthorized Client(s)in-memory.- Since:
- 5.0
- See Also:
OAuth2AuthorizedClientService,OAuth2AuthorizedClient,OAuth2AuthorizedClientId,ClientRegistration,Authentication
-
-
Constructor Summary
Constructors Constructor Description InMemoryOAuth2AuthorizedClientService(ClientRegistrationRepository clientRegistrationRepository)Constructs anInMemoryOAuth2AuthorizedClientServiceusing the provided parameters.InMemoryOAuth2AuthorizedClientService(ClientRegistrationRepository clientRegistrationRepository, java.util.Map<OAuth2AuthorizedClientId,OAuth2AuthorizedClient> authorizedClients)Constructs anInMemoryOAuth2AuthorizedClientServiceusing the provided parameters.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T extends OAuth2AuthorizedClient>
TloadAuthorizedClient(java.lang.String clientRegistrationId, java.lang.String principalName)Returns theOAuth2AuthorizedClientassociated to the provided client registration identifier and End-User'sPrincipalname ornullif not available.voidremoveAuthorizedClient(java.lang.String clientRegistrationId, java.lang.String principalName)Removes theOAuth2AuthorizedClientassociated to the provided client registration identifier and End-User'sPrincipalname.voidsaveAuthorizedClient(OAuth2AuthorizedClient authorizedClient, org.springframework.security.core.Authentication principal)Saves theOAuth2AuthorizedClientassociating it to the provided End-UserAuthentication(Resource Owner).
-
-
-
Constructor Detail
-
InMemoryOAuth2AuthorizedClientService
public InMemoryOAuth2AuthorizedClientService(ClientRegistrationRepository clientRegistrationRepository)
Constructs anInMemoryOAuth2AuthorizedClientServiceusing the provided parameters.- Parameters:
clientRegistrationRepository- the repository of client registrations
-
InMemoryOAuth2AuthorizedClientService
public InMemoryOAuth2AuthorizedClientService(ClientRegistrationRepository clientRegistrationRepository, java.util.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 Detail
-
loadAuthorizedClient
public <T extends OAuth2AuthorizedClient> T loadAuthorizedClient(java.lang.String clientRegistrationId, java.lang.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
public void saveAuthorizedClient(OAuth2AuthorizedClient authorizedClient, org.springframework.security.core.Authentication principal)
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
public void removeAuthorizedClient(java.lang.String clientRegistrationId, java.lang.String principalName)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)
-
-