Class SecuredAnnotationRule
java.lang.Object
io.micronaut.security.rules.AbstractSecurityRule<io.micronaut.http.HttpRequest<?>>
io.micronaut.security.rules.SecuredAnnotationRule
- All Implemented Interfaces:
io.micronaut.core.order.Ordered, SecurityRule<io.micronaut.http.HttpRequest<?>>
@Requires(classes=io.micronaut.http.HttpRequest.class)
@Singleton
public class SecuredAnnotationRule
extends AbstractSecurityRule<io.micronaut.http.HttpRequest<?>>
Security rule implementation for the
Secured annotation.- Since:
- 1.0
- Author:
- James Kleeh
-
Field Summary
FieldsFields inherited from interface io.micronaut.core.order.Ordered
HIGHEST_PRECEDENCE, LOWEST_PRECEDENCEFields inherited from interface SecurityRule
DENY_ALL, IS_ANONYMOUS, IS_AUTHENTICATED -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.reactivestreams.Publisher<SecurityRuleResult> check(io.micronaut.http.HttpRequest<?> request, @Nullable Authentication authentication) ReturnsSecurityRuleResult.UNKNOWNif theSecuredannotation is not found on the method or class, or if the route match is not method based.intgetOrder()Methods inherited from class AbstractSecurityRule
compareRoles, getRoles
-
Field Details
-
ORDER
The order of the rule.
-
-
Constructor Details
-
SecuredAnnotationRule
- Parameters:
rolesFinder- Roles Parser
-
-
Method Details
-
check
public org.reactivestreams.Publisher<SecurityRuleResult> check(io.micronaut.http.HttpRequest<?> request, @Nullable Authentication authentication) ReturnsSecurityRuleResult.UNKNOWNif theSecuredannotation is not found on the method or class, or if the route match is not method based.If the
Securedvalue is an expression, the request is allowed only when the expression evaluates totrue. An expression that evaluates tonull, for example one that navigates the user withuser?.for an anonymous request, rejects the request instead of deferring to later rules.- Parameters:
request- The current requestauthentication- The authentication, or null if none found- Returns:
- The result
- See Also:
-
getOrder
public int getOrder()
-