Class AbstractCachingSecurityService
- java.lang.Object
- 
- ca.bc.gov.open.cpf.plugin.impl.security.AbstractCachingSecurityService
 
- 
- All Implemented Interfaces:
- SecurityService
 - Direct Known Subclasses:
- AuthorizationServiceUserSecurityService,- MockSecurityService,- WorkerSecurityService
 
 public abstract class AbstractCachingSecurityService extends Object implements SecurityService 
- 
- 
Constructor SummaryConstructors Constructor Description AbstractCachingSecurityService(Module module, String username)AbstractCachingSecurityService(Module module, String consumerKey, String userClass, String username)
 - 
Method SummaryAll Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancanAccessResource(String resourceClass, String resourceId)Check to see if the user can access the resource.booleancanAccessResource(String resourceClass, String resourceId, String actionName)Check to see if the user can perform the action on the resource.booleancanPerformAction(String actionName)Check to see if the user is can perform the named action.voidclose()StringgetConsumerKey()Get the consumer key of the user.StringgetModuleName()Map<String,Object>getUserAttributes()Get the additional attributes about the user.StringgetUserClass()Get the classification (type) of user account.StringgetUsername()Get the login username of the user.booleanisInGroup(String groupName)Check to see if the user is a member of the named group.protected BooleanloadActionPermission(String actionName)protected BooleanloadGroupPermission(String groupName)protected BooleanloadResourceAccessPermission(String resourceClass, String resourceId, String actionName)protected Map<String,Object>loadUserAttributes()protected voidsetActionPermission(String actionName, Boolean actionPermission)protected voidsetConsumerKey(String userId)protected voidsetGroupPermission(String groupName, Boolean groupPermission)protected voidsetResourceAccessPermission(String resourceClass, String resourceId, String actionName, Boolean accessPermission)protected voidsetUserAttributes(Map<String,Object> userAttributes)protected voidsetUserClass(String userClass)protected voidsetUsername(String username)StringtoString()
 
- 
- 
- 
Method Detail- 
canAccessResourcepublic boolean canAccessResource(String resourceClass, String resourceId) Description copied from interface:SecurityServiceCheck to see if the user can access the resource. public void execute() { String resourceClass = "report"; String resourceId = "demo"; if (securityService.canAccessResource(resourceClass, resourceId)) { // Perform the request } else { throw new SecurityException("User cannot access the demo report"); } }- Specified by:
- canAccessResourcein interface- SecurityService
- Parameters:
- resourceClass- The type of resource.
- resourceId- The resource identifier.
- Returns:
- True if the user can access the resource, false otherwise.
 
 - 
canAccessResourcepublic boolean canAccessResource(String resourceClass, String resourceId, String actionName) Description copied from interface:SecurityServiceCheck to see if the user can perform the action on the resource. public void execute() { String resourceClass = "report"; String resourceId = "demo"; String actionName = "view"; if (securityService.canAccessResource(resourceClass, resourceId, actionName)) { // Perform the request } else { throw new SecurityException("User cannot perform the view action on the demo report"); } }- Specified by:
- canAccessResourcein interface- SecurityService
- Parameters:
- resourceClass- The type of resource.
- resourceId- The resource identifier.
- actionName- The action name.
- Returns:
- True if the user can perform the action on the resource, false otherwise.
 
 - 
canPerformActionpublic boolean canPerformAction(String actionName) Description copied from interface:SecurityServiceCheck to see if the user is can perform the named action. public void execute() { if (securityService.canPerformAction("view")) { // Perform the request } else { throw new SecurityException("User cannot perform the view action"); } }- Specified by:
- canPerformActionin interface- SecurityService
- Parameters:
- actionName- The action name.
- Returns:
- True if the user can perform the named action, false otherwise.
 
 - 
closepublic void close() 
 - 
getConsumerKeypublic String getConsumerKey() Description copied from interface:SecurityServiceGet the consumer key of the user. - Specified by:
- getConsumerKeyin interface- SecurityService
- Returns:
- The user's consumer key.
 
 - 
getModuleNamepublic String getModuleName() 
 - 
getUserAttributespublic Map<String,Object> getUserAttributes() Description copied from interface:SecurityServiceGet the additional attributes about the user. - Specified by:
- getUserAttributesin interface- SecurityService
- Returns:
- The additional attributes about the user.
 
 - 
getUserClasspublic String getUserClass() Description copied from interface:SecurityServiceGet the classification (type) of user account. - Specified by:
- getUserClassin interface- SecurityService
- Returns:
- The classification (type) of user account.
 
 - 
getUsernamepublic String getUsername() Description copied from interface:SecurityServiceGet the login username of the user. - Specified by:
- getUsernamein interface- SecurityService
- Returns:
- The login username of the user.
 
 - 
isInGrouppublic boolean isInGroup(String groupName) Description copied from interface:SecurityServiceCheck to see if the user is a member of the named group. public void execute() { if (securityService.isInGroup("DEMO_PARTNER")) { // Perform the request } else { throw new SecurityException("User is not a member of the DEMO_PARTNER_GROUP"); } }- Specified by:
- isInGroupin interface- SecurityService
- Parameters:
- groupName- The group name.
- Returns:
- True if the user is a member of the group, false otherwise.
 
 - 
loadResourceAccessPermissionprotected Boolean loadResourceAccessPermission(String resourceClass, String resourceId, String actionName) 
 - 
setActionPermissionprotected void setActionPermission(String actionName, Boolean actionPermission) 
 - 
setConsumerKeyprotected void setConsumerKey(String userId) 
 - 
setResourceAccessPermissionprotected void setResourceAccessPermission(String resourceClass, String resourceId, String actionName, Boolean accessPermission) 
 - 
setUserClassprotected void setUserClass(String userClass) 
 - 
setUsernameprotected void setUsername(String username) 
 
- 
 
-