public class SimplePrincipal extends AAAObjectBase implements Principal
A simple and immutable Principal implementation.
This implementation use internal data structure to store the permissions and roles granted to the principal. Sub class might choose to rely on authorization service to build up the acl
| Modifier and Type | Class and Description |
|---|---|
static class |
SimplePrincipal.Builder
The Builder can be used to build up a simple principal
|
Principal.F| Modifier and Type | Field and Description |
|---|---|
static org.osgl.Lang.Func1<Permission,Iterable<Permission>> |
EXPAND_PERMISSION |
| Constructor and Description |
|---|
SimplePrincipal()
This constructor is designed to be used by tools like ORM to deserialize the object from a certain persistent storage
|
SimplePrincipal(String name,
Privilege privilege,
Collection<? extends Role> roles,
Collection<? extends Permission> perms)
Construct a principal by name, privilege, list of roles and list of permissions
|
| Modifier and Type | Method and Description |
|---|---|
static Principal |
createSystemPrincipal(String name) |
org.osgl.util.C.List<Permission> |
getPermissions()
Returns permissions been granted to the principal
|
Privilege |
getPrivilege()
Returns the privilege granted to the principal
|
org.osgl.util.C.List<Role> |
getRoles()
Returns roles granted to the principal
|
equals, getName, getProperty, hashCode, propertyKeys, setProperty, toString, unsetPropertyclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitequals, getName, getProperty, hashCode, propertyKeys, setProperty, toString, unsetPropertypublic static final org.osgl.Lang.Func1<Permission,Iterable<Permission>> EXPAND_PERMISSION
public SimplePrincipal()
This constructor is designed to be used by tools like ORM to deserialize the object from a certain persistent storage
public SimplePrincipal(String name, Privilege privilege, Collection<? extends Role> roles, Collection<? extends Permission> perms)
Construct a principal by name, privilege, list of roles and list of permissions
name - the name of the principalprivilege - the privilegeroles - a collection of rolesperms - a collection of permissionspublic Privilege getPrivilege()
PrincipalReturns the privilege granted to the principal
public org.osgl.util.C.List<Role> getRoles()
PrincipalReturns roles granted to the principal
public org.osgl.util.C.List<Permission> getPermissions()
PrincipalReturns permissions been granted to the principal
Copyright © 2017–2020 OSGL (Open Source General Library). All rights reserved.