Class DefaultSecurityService
- java.lang.Object
-
- com.broadleafcommerce.auth.security.service.DefaultSecurityService
-
- All Implemented Interfaces:
SecurityService
public class DefaultSecurityService extends Object implements SecurityService
Default implementation of the security service that utilizes the security context and various repositories in order to assess the user's privileges.- Author:
- Nick Crum (ncrum)
-
-
Constructor Summary
Constructors Constructor Description DefaultSecurityService(PermissionRepository permissionRepository, ScopeRepository scopeRepository)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<String>checkScopes(Set<String> requestedScopes)Returns the sub-set of requested scopes that the user is permitted to access.Set<String>extractPermissions(Set<String> scopes)Returns the set of permissions the user has for the given scopes.voidsetSecurityContextAccessor(org.springframework.security.oauth2.provider.SecurityContextAccessor securityContextAccessor)
-
-
-
Constructor Detail
-
DefaultSecurityService
public DefaultSecurityService(PermissionRepository permissionRepository, ScopeRepository scopeRepository)
-
-
Method Detail
-
checkScopes
public Set<String> checkScopes(Set<String> requestedScopes)
Description copied from interface:SecurityServiceReturns the sub-set of requested scopes that the user is permitted to access. This method is used within theSecurityServiceOAuth2RequestFactoryto check that the requested scopes are accessible for the current user. If none of the requested scopes are accessible, this will return an empty set.- Specified by:
checkScopesin interfaceSecurityService- Parameters:
requestedScopes- the set of requested scopes- Returns:
- a sub-set of the requested scopes
-
extractPermissions
public Set<String> extractPermissions(Set<String> scopes)
Description copied from interface:SecurityServiceReturns the set of permissions the user has for the given scopes. This method is used within theSecurityServiceAccessTokenConverterto extract the set of permissions the user has for the requested scopes.- Specified by:
extractPermissionsin interfaceSecurityService- Parameters:
scopes- the scopes- Returns:
- a set of permissions
-
setSecurityContextAccessor
public void setSecurityContextAccessor(org.springframework.security.oauth2.provider.SecurityContextAccessor securityContextAccessor)
-
-