org.apache.shiro.web.filter.mgt.FilterChainResolver Java Examples

The following examples show how to use org.apache.shiro.web.filter.mgt.FilterChainResolver. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CoreModule.java    From onedev with MIT License 6 votes vote down vote up
private void configureSecurity() {
	contributeFromPackage(Realm.class, AbstractAuthorizingRealm.class);
	
	bind(RememberMeManager.class).to(OneRememberMeManager.class);
	bind(WebSecurityManager.class).to(OneWebSecurityManager.class);
	bind(FilterChainResolver.class).to(OneFilterChainResolver.class);
	bind(BasicAuthenticationFilter.class);
	bind(BearerAuthenticationFilter.class);
	bind(PasswordService.class).to(OnePasswordService.class);
	bind(ShiroFilter.class);
	install(new ShiroAopModule());
       contribute(FilterChainConfigurator.class, new FilterChainConfigurator() {

           @Override
           public void configure(FilterChainManager filterChainManager) {
               filterChainManager.createChain("/**/info/refs", "noSessionCreation, authcBasic, authcBearer");
               filterChainManager.createChain("/**/git-upload-pack", "noSessionCreation, authcBasic, authcBearer");
               filterChainManager.createChain("/**/git-receive-pack", "noSessionCreation, authcBasic, authcBearer");
           }
           
       });
       contributeFromPackage(Authenticator.class, Authenticator.class);
}
 
Example #2
Source File: WebSecurityModule.java    From nexus-public with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected void configureShiroWeb() {
  bindRealm().to(EmptyRealm.class); // not used in practice, just here to keep Shiro module happy

  bindSingleton(SessionFactory.class, NexusSessionFactory.class);
  bindSingleton(SessionStorageEvaluator.class, NexusSessionStorageEvaluator.class);
  bindSingleton(SubjectDAO.class, NexusSubjectDAO.class);

  // configure our preferred security components
  bindSingleton(SessionDAO.class, NexusSessionDAO.class);
  bindSingleton(Authenticator.class, FirstSuccessfulModularRealmAuthenticator.class);
  bindSingleton(Authorizer.class, ExceptionCatchingModularRealmAuthorizer.class);
  bindSingleton(FilterChainManager.class, DynamicFilterChainManager.class);

  // path matching resolver has several constructors so we need to point Guice to the appropriate one
  bind(FilterChainResolver.class).toConstructor(ctor(PathMatchingFilterChainResolver.class)).asEagerSingleton();

  // bindings used by external modules
  expose(FilterChainResolver.class);
  expose(FilterChainManager.class);
}
 
Example #3
Source File: RestShiroFilterFactoryBean.java    From bootshiro with MIT License 5 votes vote down vote up
protected SpringShiroFilter(WebSecurityManager webSecurityManager, FilterChainResolver resolver) {
    if (webSecurityManager == null) {
        throw new IllegalArgumentException("WebSecurityManager property cannot be null.");
    } else {
        this.setSecurityManager(webSecurityManager);
        if (resolver != null) {
            this.setFilterChainResolver(resolver);
        }

    }
}
 
Example #4
Source File: IamShiroFilterFactoryBean.java    From super-cloudops with Apache License 2.0 5 votes vote down vote up
protected IamSpringShiroFilter(WebSecurityManager webSecurityManager, FilterChainResolver resolver) {
	if (webSecurityManager == null) {
		throw new IllegalArgumentException("WebSecurityManager property cannot be null.");
	}
	setSecurityManager(webSecurityManager);
	if (resolver != null) {
		setFilterChainResolver(resolver);
	}
}
 
Example #5
Source File: RestShiroFilterFactoryBean.java    From Shiro-Action with MIT License 5 votes vote down vote up
protected SpringShiroFilter(WebSecurityManager webSecurityManager, FilterChainResolver resolver) {
    super();
    if (webSecurityManager == null) {
        throw new IllegalArgumentException("WebSecurityManager property cannot be null.");
    }
    setSecurityManager(webSecurityManager);
    if (resolver != null) {
        setFilterChainResolver(resolver);
    }
}
 
Example #6
Source File: JbootShiroFilter.java    From jboot with Apache License 2.0 5 votes vote down vote up
@Override
public void init() throws Exception {
    WebEnvironment env = WebUtils.getRequiredWebEnvironment(getServletContext());

    if (env.getServletContext().getContextPath() != null) {
        contextPathLength = env.getServletContext().getContextPath().length();
    }

    setSecurityManager(env.getWebSecurityManager());

    FilterChainResolver resolver = env.getFilterChainResolver();
    if (resolver != null) {
        setFilterChainResolver(resolver);
    }
}
 
Example #7
Source File: SecurityFilter.java    From nexus-public with Eclipse Public License 1.0 5 votes vote down vote up
@Inject
public SecurityFilter(final WebSecurityManager webSecurityManager,
                      final FilterChainResolver filterChainResolver)
{
  checkNotNull(webSecurityManager);
  log.trace("Security manager: {}", webSecurityManager);
  setSecurityManager(webSecurityManager);

  checkNotNull(filterChainResolver);
  log.trace("Filter chain resolver: {}", filterChainResolver);
  setFilterChainResolver(filterChainResolver);
}
 
Example #8
Source File: OneWebEnvironment.java    From onedev with MIT License 4 votes vote down vote up
@Override
public void init() throws ShiroException {
	setWebSecurityManager(OneDev.getInstance(WebSecurityManager.class));
	setFilterChainResolver(OneDev.getInstance(FilterChainResolver.class));
}
 
Example #9
Source File: SecurityFilterModule.java    From nexus-public with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected void configure() {
  requireBinding(WebSecurityManager.class);
  requireBinding(FilterChainResolver.class);
}