org.apache.shiro.mgt.SubjectFactory Java Examples
The following examples show how to use
org.apache.shiro.mgt.SubjectFactory.
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: SecurityModule.java From tapestry-security with Apache License 2.0 | 6 votes |
public static void bind(final ServiceBinder binder) { binder.bind(WebSecurityManager.class, TapestryRealmSecurityManager.class); // TYNAMO-155 It's not enough to identify ModularRealmAuthenticator by it's Authenticator interface only // because Shiro tests if the object is an instanceof LogoutAware to call logout handlers binder.bind(ModularRealmAuthenticator.class); binder.bind(SubjectFactory.class, DefaultWebSubjectFactory.class); binder.bind(HttpServletRequestFilter.class, SecurityConfiguration.class).withId("SecurityConfiguration").withMarker(Security.class); binder.bind(ClassInterceptorsCache.class, ClassInterceptorsCacheImpl.class); binder.bind(SecurityService.class, SecurityServiceImpl.class); binder.bind(SecurityFilterChainFactory.class, SecurityFilterChainFactoryImpl.class); binder.bind(ComponentRequestFilter.class, SecurityComponentRequestFilter.class); binder.bind(SecurityFilterChainHub.class, SecurityFilterChainHubImpl.class); // binder.bind(ShiroExceptionHandler.class); binder.bind(LoginContextService.class, LoginContextServiceImpl.class); binder.bind(Serializer.class, SimplePrincipalSerializer.class); }
Example #2
Source File: ShiroFilterConfiguration.java From wolf with MIT License | 5 votes |
/** * 对过滤器进行调整 * * @param securityManager * @return */ @Bean protected ShiroFilterFactoryBean shiroFilterFactoryBean(SecurityManager securityManager, SubjectFactory subjectFactory,@Qualifier("filters") Map<String, Filter> filters) { //把subject对象设为subjectFactory ((DefaultSecurityManager) securityManager).setSubjectFactory(subjectFactory); ShiroFilterFactoryBean filterFactoryBean = super.shiroFilterFactoryBean(); filterFactoryBean.setSecurityManager(securityManager); filterFactoryBean.setFilters(filters); return filterFactoryBean; }
Example #3
Source File: TapestryRealmSecurityManager.java From tapestry-security with Apache License 2.0 | 5 votes |
public TapestryRealmSecurityManager(Authenticator authenticator, SubjectFactory subjectFactory, RememberMeManager rememberMeManager, final Collection<Realm> realms) { super(); authenticator.setRealms(realms); setAuthenticator(authenticator); ((DefaultSubjectDAO) this.subjectDAO).setSessionStorageEvaluator(new DefaultWebSessionStorageEvaluator()); setSubjectFactory(subjectFactory); setRememberMeManager(rememberMeManager); setSessionManager(new ServletContainerSessionManager()); setRealms(realms); }
Example #4
Source File: SecurityGuiceConfigurer.java From seed with Mozilla Public License 2.0 | 5 votes |
public void configure(Binder binder) { // Subject SecurityConfig.SubjectConfig subjectConfig = securityConfig.subject(); Optional.ofNullable(subjectConfig.getContext()).ifPresent(c -> binder.bind(SubjectContext.class).to(c)); Optional.ofNullable(subjectConfig.getFactory()).ifPresent(f -> binder.bind(SubjectFactory.class).to(f)); Class<? extends SubjectDAO> subjectDao = subjectConfig.getDao(); binder.bind(SubjectDAO.class).to(subjectDao != null ? subjectDao : DefaultSubjectDAO.class); // Authentication SecurityConfig.AuthenticationConfig authenticationConfig = securityConfig.authentication(); binder.bind(Authenticator.class).to(authenticationConfig.getAuthenticator()); binder.bind(AuthenticationStrategy.class).to(authenticationConfig.getStrategy()); binder.bind(CredentialsMatcher.class).to(authenticationConfig.getCredentialsMatcher()); // Cache configuration SecurityConfig.CacheConfig cacheConfig = securityConfig.cache(); binder.bind(CacheManager.class).to(cacheConfig.getManager()); // Sessions SecurityConfig.SessionConfig sessionConfig = securityConfig.sessions(); binder.bind(SessionStorageEvaluator.class).to(sessionConfig.getStorageEvaluator()); Optional.ofNullable(sessionConfig.getValidationScheduler()) .ifPresent(s -> binder.bind(SessionValidationScheduler.class).to(s)); binder.bindConstant() .annotatedWith(Names.named("shiro.sessionValidationInterval")) .to(sessionConfig.getValidationInterval() * 1000); binder.bindConstant() .annotatedWith(Names.named("shiro.globalSessionTimeout")) .to(sessionConfig.getTimeout() * 1000); }
Example #5
Source File: ShiroCasWebAutoConfiguration.java From shiro-cas-spring-boot-starter with Apache License 2.0 | 4 votes |
@Bean @Override protected SubjectFactory subjectFactory() { return new CasSubjectFactory(); }
Example #6
Source File: ShiroConfiguration.java From mblog with GNU General Public License v3.0 | 4 votes |
@Bean public SubjectFactory subjectFactory() { return new AccountSubjectFactory(); }
Example #7
Source File: SecurityConfig.java From seed with Mozilla Public License 2.0 | 4 votes |
public Class<? extends SubjectFactory> getFactory() { return factory; }
Example #8
Source File: SecurityConfig.java From seed with Mozilla Public License 2.0 | 4 votes |
public SubjectConfig setFactory(Class<? extends SubjectFactory> factory) { this.factory = factory; return this; }
Example #9
Source File: ShiroConfiguration.java From springboot-shiro-cas-mybatis with MIT License | 3 votes |
/** * shiro管理器 * @Description:TODO * @author:hsj qq:2356899074 * @time:2017年12月11日 下午2:33:05 * @param pac4jRealm * @param subjectFactory * @return */ @Bean(name = "securityManager") public DefaultWebSecurityManager securityManager(Realm pac4jRealm, SubjectFactory subjectFactory) { DefaultWebSecurityManager defaultWebSecurityManager = new DefaultWebSecurityManager(); defaultWebSecurityManager.setRealm(pac4jRealm); defaultWebSecurityManager.setSubjectFactory(subjectFactory); return defaultWebSecurityManager; }
Example #10
Source File: ShiroConfiguration.java From springboot-shiro-cas-mybatis with MIT License | 2 votes |
/** * 由于cas代理了用户,所以必须通过cas进行创建对象 * * @return */ @Bean(name = "subjectFactory") protected SubjectFactory subjectFactory() { return new Pac4jSubjectFactory(); }
Example #11
Source File: ShiroConfiguration.java From wolf with MIT License | 2 votes |
/** * 由于cas代理了用户,所以必须通过cas进行创建对象 * * @return */ @Bean protected SubjectFactory subjectFactory() { return new Pac4jSubjectFactory(); }