public abstract class AbstractCachingSecurityService extends Object implements SecurityService
| Constructor and Description |
|---|
AbstractCachingSecurityService(Module module,
String username) |
AbstractCachingSecurityService(Module module,
String consumerKey,
String userClass,
String username) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
canAccessResource(String resourceClass,
String resourceId)
Check to see if the user can access the resource.
|
boolean |
canAccessResource(String resourceClass,
String resourceId,
String actionName)
Check to see if the user can perform the action on the resource.
|
boolean |
canPerformAction(String actionName)
Check to see if the user is can perform the named action.
|
void |
close() |
String |
getConsumerKey()
Get the consumer key of the user.
|
String |
getModuleName() |
Map<String,Object> |
getUserAttributes()
Get the additional attributes about the user.
|
String |
getUserClass()
Get the classification (type) of user account.
|
String |
getUsername()
Get the login username of the user.
|
boolean |
isInGroup(String groupName)
Check to see if the user is a member of the named group.
|
protected Boolean |
loadActionPermission(String actionName) |
protected Boolean |
loadGroupPermission(String groupName) |
protected Boolean |
loadResourceAccessPermission(String resourceClass,
String resourceId,
String actionName) |
protected Map<String,Object> |
loadUserAttributes() |
protected void |
setActionPermission(String actionName,
Boolean actionPermission) |
protected void |
setConsumerKey(String userId) |
protected void |
setGroupPermission(String groupName,
Boolean groupPermission) |
protected void |
setResourceAccessPermission(String resourceClass,
String resourceId,
String actionName,
Boolean accessPermission) |
protected void |
setUserAttributes(Map<String,Object> userAttributes) |
protected void |
setUserClass(String userClass) |
protected void |
setUsername(String username) |
String |
toString() |
public AbstractCachingSecurityService(Module module, String username)
public boolean canAccessResource(String resourceClass, String resourceId)
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");
}
}canAccessResource in interface SecurityServiceresourceClass - The type of resource.resourceId - The resource identifier.public boolean canAccessResource(String resourceClass, String resourceId, String actionName)
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");
}
}canAccessResource in interface SecurityServiceresourceClass - The type of resource.resourceId - The resource identifier.actionName - The action name.public boolean canPerformAction(String actionName)
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");
}
}canPerformAction in interface SecurityServiceactionName - The action name.public void close()
public String getConsumerKey()
SecurityServiceGet the consumer key of the user.
getConsumerKey in interface SecurityServicepublic String getModuleName()
public Map<String,Object> getUserAttributes()
SecurityServiceGet the additional attributes about the user.
getUserAttributes in interface SecurityServicepublic String getUserClass()
SecurityServiceGet the classification (type) of user account.
getUserClass in interface SecurityServicepublic String getUsername()
SecurityServiceGet the login username of the user.
getUsername in interface SecurityServicepublic boolean isInGroup(String groupName)
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");
}
}isInGroup in interface SecurityServicegroupName - The group name.protected Boolean loadResourceAccessPermission(String resourceClass, String resourceId, String actionName)
protected void setConsumerKey(String userId)
protected void setResourceAccessPermission(String resourceClass, String resourceId, String actionName, Boolean accessPermission)
protected void setUserClass(String userClass)
protected void setUsername(String username)
Copyright © 2008–2017 Province of British Columbia. All rights reserved.