Class ConstraintSecurityHandler

All Implemented Interfaces:
Authenticator.AuthConfiguration, ConstraintAware, Handler, HandlerContainer, Container, Destroyable, Dumpable, Dumpable.DumpableContainer, LifeCycle

@Deprecated(since="2021-05-27") public class ConstraintSecurityHandler extends SecurityHandler implements ConstraintAware
Deprecated.
The Eclipse Jetty and Apache Felix Http Jetty packages are no longer supported.
ConstraintSecurityHandler

Handler to enforce SecurityConstraints. This implementation is servlet spec 3.1 compliant and pre-computes the constraint combinations for runtime efficiency.

  • Constructor Details

    • ConstraintSecurityHandler

      public ConstraintSecurityHandler()
      Deprecated.
  • Method Details

    • createConstraint

      public static Constraint createConstraint()
      Deprecated.
    • createConstraint

      public static Constraint createConstraint(Constraint constraint)
      Deprecated.
    • createConstraint

      public static Constraint createConstraint(String name, boolean authenticate, String[] roles, int dataConstraint)
      Deprecated.
      Create a security constraint
      Parameters:
      name - the name of the constraint
      authenticate - true to authenticate
      roles - list of roles
      dataConstraint - the data constraint
      Returns:
      the constraint
    • createConstraint

      public static Constraint createConstraint(String name, HttpConstraintElement element)
      Deprecated.
      Create a Constraint
      Parameters:
      name - the name
      element - the http constraint element
      Returns:
      the created constraint
    • createConstraint

      public static Constraint createConstraint(String name, String[] rolesAllowed, ServletSecurity.EmptyRoleSemantic permitOrDeny, ServletSecurity.TransportGuarantee transport)
      Deprecated.
      Create Constraint
      Parameters:
      name - the name
      rolesAllowed - the list of allowed roles
      permitOrDeny - the permission semantic
      transport - the transport guarantee
      Returns:
      the created constraint
    • getConstraintMappingsForPath

      public static List<ConstraintMapping> getConstraintMappingsForPath(String pathSpec, List<ConstraintMapping> constraintMappings)
      Deprecated.
    • removeConstraintMappingsForPath

      public static List<ConstraintMapping> removeConstraintMappingsForPath(String pathSpec, List<ConstraintMapping> constraintMappings)
      Deprecated.
      Take out of the constraint mappings those that match the given path.
      Parameters:
      pathSpec - the path spec
      constraintMappings - a new list minus the matching constraints
      Returns:
      the list of constraint mappings
    • createConstraintsWithMappingsForPath

      public static List<ConstraintMapping> createConstraintsWithMappingsForPath(String name, String pathSpec, ServletSecurityElement securityElement)
      Deprecated.
      Generate Constraints and ContraintMappings for the given url pattern and ServletSecurityElement
      Parameters:
      name - the name
      pathSpec - the path spec
      securityElement - the servlet security element
      Returns:
      the list of constraint mappings
    • getConstraintMappings

      public List<ConstraintMapping> getConstraintMappings()
      Deprecated.
      Specified by:
      getConstraintMappings in interface ConstraintAware
    • getRoles

      public Set<String> getRoles()
      Deprecated.
      Specified by:
      getRoles in interface ConstraintAware
    • setConstraintMappings

      public void setConstraintMappings(List<ConstraintMapping> constraintMappings)
      Deprecated.
      Process the constraints following the combining rules in Servlet 3.0 EA spec section 13.7.1 Note that much of the logic is in the RoleInfo class.
      Parameters:
      constraintMappings - The constraintMappings to set, from which the set of known roles is determined.
    • setConstraintMappings

      public void setConstraintMappings(ConstraintMapping[] constraintMappings)
      Deprecated.
      Process the constraints following the combining rules in Servlet 3.0 EA spec section 13.7.1 Note that much of the logic is in the RoleInfo class.
      Parameters:
      constraintMappings - The constraintMappings to set as array, from which the set of known roles is determined. Needed to retain API compatibility for 7.x
    • setConstraintMappings

      public void setConstraintMappings(List<ConstraintMapping> constraintMappings, Set<String> roles)
      Deprecated.
      Process the constraints following the combining rules in Servlet 3.0 EA spec section 13.7.1 Note that much of the logic is in the RoleInfo class.
      Specified by:
      setConstraintMappings in interface ConstraintAware
      Parameters:
      constraintMappings - The constraintMappings to set.
      roles - The known roles (or null to determine them from the mappings)
    • setRoles

      public void setRoles(Set<String> roles)
      Deprecated.
      Set the known roles. This may be overridden by a subsequent call to setConstraintMappings(ConstraintMapping[]) or setConstraintMappings(List, Set).
      Parameters:
      roles - The known roles (or null to determine them from the mappings)
    • addConstraintMapping

      public void addConstraintMapping(ConstraintMapping mapping)
      Deprecated.
      Description copied from interface: ConstraintAware
      Add a Constraint Mapping. May be called for running webapplication as an annotated servlet is instantiated.
      Specified by:
      addConstraintMapping in interface ConstraintAware
      Parameters:
      mapping - the mapping
      See Also:
    • addRole

      public void addRole(String role)
      Deprecated.
      Description copied from interface: ConstraintAware
      Add a Role definition. May be called on running webapplication as an annotated servlet is instantiated.
      Specified by:
      addRole in interface ConstraintAware
      Parameters:
      role - the role
      See Also:
    • dump

      public void dump(Appendable out, String indent) throws IOException
      Deprecated.
      Description copied from interface: Dumpable
      Dump this object (and children) into an Appendable using the provided indent after any new lines. The indent should not be applied to the first object dumped.
      Specified by:
      dump in interface Dumpable
      Overrides:
      dump in class ContainerLifeCycle
      Parameters:
      out - The appendable to dump to
      indent - The indent to apply after any new lines.
      Throws:
      IOException - if unable to write to Appendable
    • setDenyUncoveredHttpMethods

      public void setDenyUncoveredHttpMethods(boolean deny)
      Deprecated.
      Description copied from interface: ConstraintAware
      See Servlet Spec 31, sec 13.8.4, pg 145 When true, requests with http methods not explicitly covered either by inclusion or omissions in constraints, will have access denied.
      Specified by:
      setDenyUncoveredHttpMethods in interface ConstraintAware
      Parameters:
      deny - true for denied method access
      See Also:
    • isDenyUncoveredHttpMethods

      public boolean isDenyUncoveredHttpMethods()
      Deprecated.
      Specified by:
      isDenyUncoveredHttpMethods in interface ConstraintAware
    • checkPathsWithUncoveredHttpMethods

      public boolean checkPathsWithUncoveredHttpMethods()
      Deprecated.
      Servlet spec 3.1 pg. 147.
      Specified by:
      checkPathsWithUncoveredHttpMethods in interface ConstraintAware
      Returns:
      true if urls with uncovered http methods
    • getPathsWithUncoveredHttpMethods

      public Set<String> getPathsWithUncoveredHttpMethods()
      Deprecated.
      Servlet spec 3.1 pg. 147. The container must check all the combined security constraint information and log any methods that are not protected and the urls at which they are not protected
      Returns:
      list of paths for which there are uncovered methods