Class BuiltInMethods
- java.lang.Object
-
- io.helidon.security.abac.policy.el.BuiltInMethods
-
public final class BuiltInMethods extends Object
Built-in methods for expression language evaluation. These methods are bound in default namespace (without a prefix). Name to use in an expression is the name of the method.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
inRole(Subject subject, String role)
Check if subject has the specified role.static boolean
inRoles(Subject subject, String... roles)
Check if subject has the specified roles (must have all of them).static boolean
inScope(Subject subject, String scope)
Check if subject has the specified scope.static boolean
inScopes(Subject subject, String... scopes)
Check if subject has the specified scopes (must have all of them).
-
-
-
Method Detail
-
inRole
public static boolean inRole(Subject subject, String role)
Check if subject has the specified role.- Parameters:
subject
- subject of a user or a servicerole
- role the subject should be in- Returns:
- true if the subject is in the role
-
inRoles
public static boolean inRoles(Subject subject, String... roles)
Check if subject has the specified roles (must have all of them). If you need to check that subject is in EITHER of the roles, you should combine this will or operator (e.g. inRole(user, "manager") || inRole(user, "admin"))- Parameters:
subject
- subject of a user or a serviceroles
- roles the subject should be in- Returns:
- true if the subject is in all the specified roles
-
inScope
public static boolean inScope(Subject subject, String scope)
Check if subject has the specified scope.- Parameters:
subject
- subject of a userscope
- scope the subject should have- Returns:
- true if the subject has all the specified scopes
-
-