Package org.eclipse.jetty.annotations
Class ServletSecurityAnnotationHandler
java.lang.Object
org.eclipse.jetty.annotations.AnnotationIntrospector.AbstractIntrospectableAnnotationHandler
org.eclipse.jetty.annotations.ServletSecurityAnnotationHandler
- All Implemented Interfaces:
AnnotationIntrospector.IntrospectableAnnotationHandler
public class ServletSecurityAnnotationHandler
extends AnnotationIntrospector.AbstractIntrospectableAnnotationHandler
ServletSecurityAnnotationHandler
Inspect a class to see if it has an
@ServletSecurity
annotation on it,
setting up the <security-constraint>s
.
A servlet can be defined in:
- web.xml
- web-fragment.xml
- @WebServlet annotation discovered
- ServletContext.createServlet
-
Field Summary
Fields inherited from class org.eclipse.jetty.annotations.AnnotationIntrospector.AbstractIntrospectableAnnotationHandler
_context, _introspectAncestors
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
constraintsExist
(List<ServletMapping> servletMappings, List<ConstraintMapping> constraintMappings) Check if there are already<security-constraint>
elements defined that match the url-patterns for the servlet.void
protected List<ServletMapping>
getServletMappings
(String className) Get the ServletMappings for the servlet's class.protected Constraint
makeConstraint
(Class servlet, String[] rolesAllowed, jakarta.servlet.annotation.ServletSecurity.EmptyRoleSemantic permitOrDeny, jakarta.servlet.annotation.ServletSecurity.TransportGuarantee transport) Make a jetty Constraint object, which represents the<auth-constraint>
and<user-data-constraint>
elements, based on the security annotation.Methods inherited from class org.eclipse.jetty.annotations.AnnotationIntrospector.AbstractIntrospectableAnnotationHandler
getContext, handle
-
Constructor Details
-
ServletSecurityAnnotationHandler
-
-
Method Details
-
doHandle
- Specified by:
doHandle
in classAnnotationIntrospector.AbstractIntrospectableAnnotationHandler
-
makeConstraint
protected Constraint makeConstraint(Class servlet, String[] rolesAllowed, jakarta.servlet.annotation.ServletSecurity.EmptyRoleSemantic permitOrDeny, jakarta.servlet.annotation.ServletSecurity.TransportGuarantee transport) Make a jetty Constraint object, which represents the<auth-constraint>
and<user-data-constraint>
elements, based on the security annotation.- Parameters:
servlet
- the servletrolesAllowed
- the roles allowedpermitOrDeny
- the role / permission semantictransport
- the transport guarantee- Returns:
- the constraint
-
getServletMappings
Get the ServletMappings for the servlet's class.- Parameters:
className
- the class name- Returns:
- the servlet mappings for the class
-
constraintsExist
protected boolean constraintsExist(List<ServletMapping> servletMappings, List<ConstraintMapping> constraintMappings) Check if there are already<security-constraint>
elements defined that match the url-patterns for the servlet.- Parameters:
servletMappings
- the servlet mappingsconstraintMappings
- the constraint mappings- Returns:
- true if constraint exists
-