|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.apache.shiro.authz.SimpleAuthorizationInfo
public class SimpleAuthorizationInfo
Simple POJO implementation of the AuthorizationInfo interface that stores roles and permissions as internal
attributes.
AuthorizingRealm,
Serialized Form| Field Summary | |
|---|---|
protected Set<Permission> |
objectPermissions
Collection of all object-based permissions associaed with the account. |
protected Set<String> |
roles
The internal roles collection. |
protected Set<String> |
stringPermissions
Collection of all string-based permissions associated with the account. |
| Constructor Summary | |
|---|---|
SimpleAuthorizationInfo()
Default no-argument constructor. |
|
SimpleAuthorizationInfo(Set<String> roles)
Creates a new instance with the specified roles and no permissions. |
|
| Method Summary | |
|---|---|
void |
addObjectPermission(Permission permission)
Adds (assigns) a permission to those directly associated with the account. |
void |
addObjectPermissions(Collection<Permission> permissions)
Adds (assigns) multiple permissions to those associated directly with the account. |
void |
addRole(String role)
Adds (assigns) a role to those associated with the account. |
void |
addRoles(Collection<String> roles)
Adds (assigns) multiple roles to those associated with the account. |
void |
addStringPermission(String permission)
Adds (assigns) a permission to those directly associated with the account. |
void |
addStringPermissions(Collection<String> permissions)
Adds (assigns) multiple permissions to those associated directly with the account. |
Set<Permission> |
getObjectPermissions()
Returns all type-safe Permissions assigned to the corresponding Subject. |
Set<String> |
getRoles()
Returns the names of all roles assigned to a corresponding Subject. |
Set<String> |
getStringPermissions()
Returns all string-based permissions assigned to the corresponding Subject. |
void |
setObjectPermissions(Set<Permission> objectPermissions)
Sets the object-based permissions assigned directly to the account. |
void |
setRoles(Set<String> roles)
Sets the roles assigned to the account. |
void |
setStringPermissions(Set<String> stringPermissions)
Sets the string-based permissions assigned directly to the account. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected Set<String> roles
protected Set<String> stringPermissions
protected Set<Permission> objectPermissions
| Constructor Detail |
|---|
public SimpleAuthorizationInfo()
public SimpleAuthorizationInfo(Set<String> roles)
roles - the roles assigned to the realm account.| Method Detail |
|---|
public Set<String> getRoles()
AuthorizationInfo
getRoles in interface AuthorizationInfopublic void setRoles(Set<String> roles)
roles - the roles assigned to the account.public void addRole(String role)
role - the role to add to those associated with the account.public void addRoles(Collection<String> roles)
roles - the roles to add to those associated with the account.public Set<String> getStringPermissions()
AuthorizationInfogetObjectPermissions() represent the total set of permissions
assigned. The aggregate set is used to perform a permission authorization check.
This method is a convenience mechanism that allows Realms to represent permissions as Strings if they choose.
When performing a security check, a Realm usually converts these strings to object
Permissions via an internal
PermissionResolver
in order to perform the actual permission check. This is not a requirement of course, since Realms
can perform security checks in whatever manner deemed necessary, but this explains the conversion mechanism that
most Shiro Realms execute for string-based permission checks.
getStringPermissions in interface AuthorizationInfopublic void setStringPermissions(Set<String> stringPermissions)
object permissions constitute the total permissions assigned directly to the
account.
stringPermissions - the string-based permissions assigned directly to the account.public void addStringPermission(String permission)
permission - the permission to add to those directly assigned to the account.public void addStringPermissions(Collection<String> permissions)
permissions - the permissions to add to those associated directly with the account.public Set<Permission> getObjectPermissions()
AuthorizationInfoPermissions assigned to the corresponding Subject. The permissions
returned from this method plus any returned from getStringPermissions()
represent the total set of permissions. The aggregate set is used to perform a permission authorization check.
getObjectPermissions in interface AuthorizationInfoPermissions assigned to the corresponding Subject.public void setObjectPermissions(Set<Permission> objectPermissions)
string permissions constitute the total permissions assigned directly to the
account.
objectPermissions - the object-based permissions assigned directly to the account.public void addObjectPermission(Permission permission)
Permission>) will be created automatically.
permission - the permission to add to those directly assigned to the account.public void addObjectPermissions(Collection<Permission> permissions)
Permission>)
will be created automatically.
permissions - the permissions to add to those associated directly with the account.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||