Class IPRangeAccessControl

All Implemented Interfaces:
Component, DestructableComponent, IdentifiableComponent, IdentifiedComponent, InitializableComponent, AccessControl

public class IPRangeAccessControl extends AbstractIdentifiableInitializableComponent implements AccessControl
Simple access control implementation based on IP address checking.
  • Field Details

    • log

      @Nonnull private final org.slf4j.Logger log
      Class logger.
    • allowedRanges

      @Nonnull @NonnullElements private Collection<IPRange> allowedRanges
      List of CIDR blocks allowed to access this servlet.
  • Constructor Details

    • IPRangeAccessControl

      public IPRangeAccessControl()
      Constructor.
  • Method Details

    • setAllowedRanges

      public void setAllowedRanges(@Nonnull @NonnullElements Collection<IPRange> ranges)
      Set the CIDR address ranges to allow.
      Parameters:
      ranges - ranges to allow
    • checkAccess

      public boolean checkAccess(@Nonnull javax.servlet.ServletRequest request, @Nullable String operation, @Nullable String resource)
      Determine whether the request to the resource should be granted.
      Specified by:
      checkAccess in interface AccessControl
      Parameters:
      request - request to check
      operation - operation being performed
      resource - target resource
      Returns:
      true iff access should be granted
    • getLogPrefix

      @Nonnull private String getLogPrefix()
      Get logging prefix.
      Returns:
      prefix