Package io.micronaut.security.token
Interface RolesFinder
- All Known Implementing Classes:
DefaultRolesFinder
Retrieves roles from token claims.
- Since:
- 1.1.0
- Author:
- Sergio del Amo
-
Method Summary
Modifier and TypeMethodDescriptiondefault boolean
hasAnyRequiredRoles
(@NonNull List<String> requiredRoles, @NonNull Collection<String> grantedRoles) default boolean
resolveRoles
(@Nullable Map<String, Object> attributes) Retrieves the list of roles from the User Attributes.
-
Method Details
-
hasAnyRequiredRoles
default boolean hasAnyRequiredRoles(@NonNull @NonNull List<String> requiredRoles, @Nullable @Nullable Map<String, Object> attributes) - Parameters:
requiredRoles
- The list of roles required to be authorizedattributes
- User's attributes- Returns:
- true if any the roles specified in the attributes is in the required roles list.
-
hasAnyRequiredRoles
default boolean hasAnyRequiredRoles(@NonNull @NonNull List<String> requiredRoles, @NonNull @NonNull Collection<String> grantedRoles) - Parameters:
requiredRoles
- The list of roles required to be authorizedgrantedRoles
- The list of roles granted to the user- Returns:
- true if any of the granted roles is in the required roles list.
-
resolveRoles
Retrieves the list of roles from the User Attributes.- Parameters:
attributes
- User's attributes- Returns:
- The granted roles.
-