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(UserPrincipal("Bob")) or PrincipalPermission(GroupPrincipal("users")) or PrincipalPermission(none) it is authorized to execute it.
Modifier and Type | Field and Description |
---|---|
protected List<IdentityPrincipal> |
principals |
Constructor and Description |
---|
PrincipalPermission(IdentityPrincipal principal) |
PrincipalPermission(String name,
Set<? extends IdentityPrincipal> principals) |
Modifier and Type | Method and Description |
---|---|
void |
addPermission(IdentityPrincipal tokenPrincipal) |
boolean |
equals(Object o) |
List<String> |
getAllTokens() |
int |
hashCode() |
boolean |
hasPrincipal(IdentityPrincipal principal) |
boolean |
implies(Permission permission) |
boolean |
isAnyToken() |
PermissionCollection |
newPermissionCollection() |
void |
removePermission(IdentityPrincipal tokenPrincipal) |
void |
setAllTokens(List<String> tokens) |
String |
toString() |
getActions
checkGuard, getName
protected List<IdentityPrincipal> principals
public PrincipalPermission(IdentityPrincipal principal)
public PrincipalPermission(String name, Set<? extends IdentityPrincipal> principals)
public boolean implies(Permission permission)
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)
public void addPermission(IdentityPrincipal tokenPrincipal)
public void removePermission(IdentityPrincipal tokenPrincipal)
public boolean isAnyToken()