Class SecurityConstraintMapping

java.lang.Object
org.apache.camel.component.netty.http.SecurityConstraintMapping
All Implemented Interfaces:
SecurityConstraint

public class SecurityConstraintMapping extends Object implements SecurityConstraint
A default SecurityConstraint which can be used to define a set of mappings to as constraints.

This constraint will match as true if no inclusions has been defined. First all the inclusions is check for matching. If a inclusion matches, then the exclusion is checked, and if any of them matches, then the exclusion will override the match and force returning false.

Wildcards and regular expressions is supported as this implementation uses PatternHelper.matchPattern(String, String) method for matching.

This restricted constraint allows you to setup context path rules that will restrict access to paths, and then override and have exclusions that may allow access to public paths.

  • Constructor Details

    • SecurityConstraintMapping

      public SecurityConstraintMapping()
  • Method Details

    • restricted

      public String restricted(String url)
      Description copied from interface: SecurityConstraint
      Performs a security restricted check for the given web resource.

      The returned value indicates which roles the user must be in to access the restricted resource.

      Specified by:
      restricted in interface SecurityConstraint
      Parameters:
      url - the web resource
      Returns:
      null if not restricted, otherwise * (wildcard) matches any roles, otherwise a comma separated String with roles
    • addInclusion

      public void addInclusion(String constraint)
    • addInclusion

      public void addInclusion(String constraint, String roles)
    • addExclusion

      public void addExclusion(String constraint)
    • setInclusions

      public void setInclusions(Map<String,String> inclusions)
    • setExclusions

      public void setExclusions(Set<String> exclusions)