Tabnine Logo
FilterChainManager
Code IndexAdd Tabnine to your IDE (free)

How to use
FilterChainManager
in
org.apache.shiro.web.filter.mgt

Best Java code snippets using org.apache.shiro.web.filter.mgt.FilterChainManager (Showing top 7 results out of 315)

origin: apache/shiro

public FilterChain getChain(ServletRequest request, ServletResponse response, FilterChain originalChain) {
  FilterChainManager filterChainManager = getFilterChainManager();
  if (!filterChainManager.hasChains()) {
    return null;
  }
  String requestURI = getPathWithinApplication(request);
  //the 'chain names' in this implementation are actually path patterns defined by the user.  We just use them
  //as the chain name for the FilterChainManager's requirements
  for (String pathPattern : filterChainManager.getChainNames()) {
    // If the path does match, then pass on to the subclass implementation for specific checks:
    if (pathMatches(pathPattern, requestURI)) {
      if (log.isTraceEnabled()) {
        log.trace("Matched path pattern [" + pathPattern + "] for requestURI [" + requestURI + "].  " +
            "Utilizing corresponding filter chain...");
      }
      return filterChainManager.proxy(originalChain, pathPattern);
    }
  }
  return null;
}
origin: apache/shiro

protected void registerFilters(Map<String, Filter> filters, FilterChainManager manager) {
  if (!CollectionUtils.isEmpty(filters)) {
    boolean init = getFilterConfig() != null; //only call filter.init if there is a FilterConfig available
    for (Map.Entry<String, Filter> entry : filters.entrySet()) {
      String name = entry.getKey();
      Filter filter = entry.getValue();
      manager.addFilter(name, filter, init);
    }
  }
}
origin: apache/shiro

  protected void createChains(Map<String, String> urls, FilterChainManager manager) {
    if (CollectionUtils.isEmpty(urls)) {
      if (log.isDebugEnabled()) {
        log.debug("No urls to process.");
      }
      return;
    }

    if (log.isTraceEnabled()) {
      log.trace("Before url processing.");
    }

    for (Map.Entry<String, String> entry : urls.entrySet()) {
      String path = entry.getKey();
      String value = entry.getValue();
      manager.createChain(path, value);
    }
  }
}
origin: theonedev/onedev

@Inject
public OneFilterChainResolver(
    Set<FilterChainConfigurator> filterChainConfigurators, 
    BasicAuthenticationFilter basicAuthenticationFilter) {
  
  super();
  
  FilterChainManager filterChainManager = getFilterChainManager();
  
  filterChainManager.addFilter("authcBasic", basicAuthenticationFilter);
  
  for (FilterChainConfigurator configurator: filterChainConfigurators) {
    configurator.configure(filterChainManager);
  }
  
  filterChainManager.createChain("/**", "authcBasic");
}

origin: apache/shiro

protected void buildChains(FilterChainManager manager, Ini ini) {
  //filters section:
  Ini.Section section = ini.getSection(FILTERS);
  if (!CollectionUtils.isEmpty(section)) {
    String msg = "The [{}] section has been deprecated and will be removed in a future release!  Please " +
        "move all object configuration (filters and all other objects) to the [{}] section.";
    log.warn(msg, FILTERS, IniSecurityManagerFactory.MAIN_SECTION_NAME);
  }
  Map<String, Object> defaults = new LinkedHashMap<String, Object>();
  Map<String, Filter> defaultFilters = manager.getFilters();
  //now let's see if there are any object defaults in addition to the filters
  //these can be used to configure the filters:
  //create a Map of objects to use as the defaults:
  if (!CollectionUtils.isEmpty(defaultFilters)) {
    defaults.putAll(defaultFilters);
  }
  //User-provided objects must come _after_ the default filters - to allow the user-provided
  //ones to override the default filters if necessary.
  Map<String, ?> defaultBeans = getDefaults();
  if (!CollectionUtils.isEmpty(defaultBeans)) {
    defaults.putAll(defaultBeans);
  }
  Map<String, Filter> filters = getFilters(section, defaults);
  //add the filters to the manager:
  registerFilters(filters, manager);
  //urls section:
  section = ini.getSection(URLS);
  createChains(section, manager);
}
origin: be.c4j.ee.security.octopus/octopus-core

  public FilterChain getChain(ServletRequest request, ServletResponse response, FilterChain originalChain) {
    FilterChainManager filterChainManager = getFilterChainManager();
    if (!filterChainManager.hasChains()) {
      return null;
    }

    String requestURI = getPathWithinApplication(request);

    //the 'chain names' in this implementation are actually path patterns defined by the user.  We just use them
    //as the chain name for the FilterChainManager's requirements
    for (String pathPattern : filterChainManager.getChainNames()) {

      // If the path does match, then pass on to the subclass implementation for specific checks:
      if (pathMatches(pathPattern, requestURI)) {
        if (log.isTraceEnabled()) {
          log.trace("Matched path pattern [" + pathPattern + "] for requestURI [" + requestURI + "].  " +
              "Utilizing corresponding filter chain...");
        }

        // This is the only change we have made in this method.
        request.setAttribute(OCTOPUS_CHAIN_NAME, pathPattern);
        return filterChainManager.proxy(originalChain, pathPattern);
      }
    }

    return null;
  }
}
origin: tomsun28/bootshiro

@Override
public FilterChain getChain(ServletRequest request, ServletResponse response, FilterChain originalChain) {
  FilterChainManager filterChainManager = this.getFilterChainManager();
  if (!filterChainManager.hasChains()) {
    return null;
  } else {
    String requestURI = this.getPathWithinApplication(request);
    Iterator var6 = filterChainManager.getChainNames().iterator();
    return filterChainManager.proxy(originalChain, pathPattern);
org.apache.shiro.web.filter.mgtFilterChainManager

Javadoc

A FilterChainManager manages the creation and modification of Filter chains from an available pool of Filter instances.

Most used methods

  • getChainNames
  • hasChains
  • proxy
  • addFilter
    Adds a filter to the 'pool' of available filters that can be used when #addToChain(String,String,Str
  • createChain
    Creates a filter chain for the given chainName with the specified chainDefinitionString.CONVENTIONAL
  • getFilters
    Returns the pool of available Filters managed by this manager, keyed by name.

Popular in Java

  • Reading from database using SQL prepared statement
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • compareTo (BigDecimal)
  • onCreateOptionsMenu (Activity)
  • FileReader (java.io)
    A specialized Reader that reads from a file in the file system. All read requests made by calling me
  • FileWriter (java.io)
    A specialized Writer that writes to a file in the file system. All write requests made by calling me
  • InetAddress (java.net)
    An Internet Protocol (IP) address. This can be either an IPv4 address or an IPv6 address, and in pra
  • LinkedHashMap (java.util)
    LinkedHashMap is an implementation of Map that guarantees iteration order. All optional operations a
  • Project (org.apache.tools.ant)
    Central representation of an Ant project. This class defines an Ant project with all of its targets,
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • Github Copilot alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now