Package org.genesys.blocks.oauth.service
Class OAuthServiceImpl
- java.lang.Object
-
- org.genesys.blocks.oauth.service.OAuthServiceImpl
-
- All Implemented Interfaces:
OAuthClientDetailsService,org.springframework.security.oauth2.provider.ClientDetailsService
@Service @Transactional(readOnly=true) public class OAuthServiceImpl extends Object implements OAuthClientDetailsService
The Class OAuthServiceImpl.
-
-
Field Summary
Fields Modifier and Type Field Description org.springframework.security.crypto.password.PasswordEncoderpasswordEncoderThe password encoder.
-
Constructor Summary
Constructors Constructor Description OAuthServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description OAuthClientaddClient(OAuthClient client)Register a new OAuth client.List<OAuthClient>autocompleteClients(String term, int limit)Autocomplete OAuth clients by title.OAuthClientgetClient(String clientId)Gets the client.booleanisOriginRegistered(String origin)Check if the origin is registered with one of the clientsList<OAuthClient>listClientDetails()List client details.org.springframework.data.domain.Page<OAuthClient>listClientDetails(org.springframework.data.domain.Pageable pageable)List client details.org.springframework.security.oauth2.provider.ClientDetailsloadClientByClientId(String clientId)OAuthClientremoveClient(OAuthClient client)Removes the client.OAuthClientremoveSecret(OAuthClient oauthClient)Removes the Client secret.StringresetSecret(OAuthClient oauthClient)Generates a new clientSecret.OAuthClientupdateClient(long id, int version, OAuthClient updates)Update client.
-
-
-
Method Detail
-
loadClientByClientId
@Cacheable(cacheNames="oauthclient", key="#clientId", unless="#result == null") public org.springframework.security.oauth2.provider.ClientDetails loadClientByClientId(String clientId) throws org.springframework.security.oauth2.provider.ClientRegistrationException- Specified by:
loadClientByClientIdin interfaceorg.springframework.security.oauth2.provider.ClientDetailsService- Throws:
org.springframework.security.oauth2.provider.ClientRegistrationException
-
listClientDetails
public List<OAuthClient> listClientDetails()
Description copied from interface:OAuthClientDetailsServiceList client details.- Specified by:
listClientDetailsin interfaceOAuthClientDetailsService- Returns:
- the list
-
listClientDetails
public org.springframework.data.domain.Page<OAuthClient> listClientDetails(org.springframework.data.domain.Pageable pageable)
Description copied from interface:OAuthClientDetailsServiceList client details.- Specified by:
listClientDetailsin interfaceOAuthClientDetailsService- Parameters:
pageable- the pageable- Returns:
- page with Client details
-
getClient
public OAuthClient getClient(String clientId)
Description copied from interface:OAuthClientDetailsServiceGets the client.- Specified by:
getClientin interfaceOAuthClientDetailsService- Parameters:
clientId- the client id- Returns:
- the client
-
removeClient
@Transactional @CacheEvict(cacheNames="oauthclient", key="#client.clientId", condition="#client != null") public OAuthClient removeClient(OAuthClient client)Description copied from interface:OAuthClientDetailsServiceRemoves the client.- Specified by:
removeClientin interfaceOAuthClientDetailsService- Parameters:
client- the oauth client- Returns:
- the o auth client
-
addClient
@Transactional public OAuthClient addClient(OAuthClient client)
Description copied from interface:OAuthClientDetailsServiceRegister a new OAuth client.- Specified by:
addClientin interfaceOAuthClientDetailsService- Parameters:
client- the client- Returns:
- the OAuth client
-
updateClient
@Transactional @CacheEvict(cacheNames="oauthclient", key="#updates.clientId", condition="#updates != null") public OAuthClient updateClient(long id, int version, OAuthClient updates)Description copied from interface:OAuthClientDetailsServiceUpdate client.- Specified by:
updateClientin interfaceOAuthClientDetailsService- Parameters:
id- the idversion- the versionupdates- the updates- Returns:
- the o auth client
-
autocompleteClients
public List<OAuthClient> autocompleteClients(String term, int limit)
Description copied from interface:OAuthClientDetailsServiceAutocomplete OAuth clients by title.- Specified by:
autocompleteClientsin interfaceOAuthClientDetailsService- Parameters:
term- the titlelimit- maximum number of results- Returns:
- list of auth clients
-
resetSecret
@Transactional @PreAuthorize("hasRole(\'ADMINISTRATOR\') or hasPermission(#oauthClient, \'ADMINISTRATION\')") public final String resetSecret(OAuthClient oauthClient)Description copied from interface:OAuthClientDetailsServiceGenerates a new clientSecret.- Specified by:
resetSecretin interfaceOAuthClientDetailsService- Parameters:
oauthClient- the client to regenerate secret for- Returns:
- the new cliet secret
-
removeSecret
@Transactional @PreAuthorize("hasRole(\'ADMINISTRATOR\') or hasPermission(#oauthClient, \'ADMINISTRATION\')") public final OAuthClient removeSecret(OAuthClient oauthClient)Description copied from interface:OAuthClientDetailsServiceRemoves the Client secret.- Specified by:
removeSecretin interfaceOAuthClientDetailsService- Parameters:
oauthClient- the oauth client- Returns:
- Updated OAuth client
-
isOriginRegistered
public boolean isOriginRegistered(String origin)
Description copied from interface:OAuthClientDetailsServiceCheck if the origin is registered with one of the clients- Specified by:
isOriginRegisteredin interfaceOAuthClientDetailsService- Parameters:
origin- the origin- Returns:
- true if a client exists with this origin, false otherwise
-
-