public class PrincipalPermission extends ClientPermission
For example this permission is checked in the scheduler when the user tries to remove the job to allow users remove only their own jobs.
Then user is authenticated in JAAS it automatically has all PrincipalPermissions of those principal it associated with. For example when a user named "Bob" is authenticated and it is a member of group "users" it will have 2 PrincipalPermission: PrincipalPermission(UserPrincipal("Bob")) and PrincipalPermission(GroupPrincipal("users")).
Then in the code if an action is limited to PrincipalPermission(UserPrincipal("Jon")) Bob cannot access it. If it's limited to PrincipalPermission(GroupPrincipal("Bob")) or PrincipalPermission(GroupPrincipal("users")) or PrincipalPermission(none) it is authorized to execute it.
Constructor and Description |
---|
PrincipalPermission(IdentityPrincipal principal) |
PrincipalPermission(String name,
Set<? extends IdentityPrincipal> principals) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object o) |
int |
hashCode() |
boolean |
hasPrincipal(IdentityPrincipal principal) |
boolean |
implies(Permission p) |
PermissionCollection |
newPermissionCollection() |
String |
toString() |
getActions
checkGuard, getName
public PrincipalPermission(IdentityPrincipal principal)
public PrincipalPermission(String name, Set<? extends IdentityPrincipal> principals)
public boolean implies(Permission p)
implies
in class BasicPermission
public boolean equals(Object o)
equals
in class BasicPermission
public int hashCode()
hashCode
in class BasicPermission
public String toString()
toString
in class Permission
public PermissionCollection newPermissionCollection()
newPermissionCollection
in class BasicPermission
public boolean hasPrincipal(IdentityPrincipal principal)