当前位置: 首页>>代码示例>>Java>>正文


Java DefaultWebSecurityManager.setSubjectFactory方法代码示例

本文整理汇总了Java中org.apache.shiro.web.mgt.DefaultWebSecurityManager.setSubjectFactory方法的典型用法代码示例。如果您正苦于以下问题:Java DefaultWebSecurityManager.setSubjectFactory方法的具体用法?Java DefaultWebSecurityManager.setSubjectFactory怎么用?Java DefaultWebSecurityManager.setSubjectFactory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.shiro.web.mgt.DefaultWebSecurityManager的用法示例。


在下文中一共展示了DefaultWebSecurityManager.setSubjectFactory方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: securityManager

import org.apache.shiro.web.mgt.DefaultWebSecurityManager; //导入方法依赖的package包/类
@Bean(name = "securityManager")
	@ConditionalOnMissingBean
	public DefaultSecurityManager securityManager(CacheManager shiroCacheManager) {
        DefaultWebSecurityManager dwsm = new DefaultWebSecurityManager();

        // 用自己的Factory实现替换默认
        // 用于关闭session功能
        dwsm.setSubjectFactory(new StatelessSubjectFactory());
        dwsm.setSessionManager(defaultSessionManager());
        // 关闭session存储
        ((DefaultSessionStorageEvaluator) ((DefaultSubjectDAO)dwsm.getSubjectDAO()).getSessionStorageEvaluator()).setSessionStorageEnabled(false);

//      <!-- 用户授权/认证信息Cache, 采用EhCache 缓存 -->
        dwsm.setCacheManager(shiroCacheManager);

        SecurityUtils.setSecurityManager(dwsm);
        return dwsm;
	}
 
开发者ID:wanghongfei,项目名称:shiro-spring-boot-starter,代码行数:19,代码来源:ShiroManager.java

示例2: securityManager

import org.apache.shiro.web.mgt.DefaultWebSecurityManager; //导入方法依赖的package包/类
@Bean
public DefaultWebSecurityManager securityManager() {
	realms = realms == null ? new ArrayList<Realm>() : realms;
	boolean existCasRealm = false;
	for (Realm realm : realms) {
		if (realm == casRealm()) {
			existCasRealm = true;
			break;
		}
	}
	if (!existCasRealm) {
		realms.add(0, casRealm());
	}
	
	DefaultWebSecurityManager manager = new DefaultWebSecurityManager();
	//authenticator必须在realm前面设值,因为setRealm时会有条件的设置authenticator里的realm
	manager.setAuthenticator(authenticator());
	manager.setSubjectFactory(casSubjectFactory());
	manager.setCacheManager(securityCacheManager());
	manager.setSessionManager(sessionManager());
	manager.setRealms(realms);
	return manager;
}
 
开发者ID:easycodebox,项目名称:easycode,代码行数:24,代码来源:ShiroConfig.java

示例3: createSecurityManager

import org.apache.shiro.web.mgt.DefaultWebSecurityManager; //导入方法依赖的package包/类
private SecurityManager createSecurityManager() {

        // create security manager
        DefaultWebSecurityManager securityManager = /*new DefaultWebSecurityManager();/*/new JawnSecurityManager();
        
        // add rememberme manager
        securityManager.setSessionManager(new JawnSecuritySessionManager());//TODO
        securityManager.setRememberMeManager(new JawnRememberMeManager());//TODO
        securityManager.setSubjectFactory(new JWebSubjectFactory());//TODO

        Collection<Realm> realms = readRealms();

        // add realms to security manager
        if (!realms.isEmpty())
            applyRealmsToSecurityManager(realms, securityManager);

        return securityManager;
    }
 
开发者ID:MTDdk,项目名称:jawn,代码行数:19,代码来源:JawnSecurityManagerFactory.java

示例4: getDefaultWebSecurityManager

import org.apache.shiro.web.mgt.DefaultWebSecurityManager; //导入方法依赖的package包/类
@Bean(name = "securityManager")
    public DefaultWebSecurityManager getDefaultWebSecurityManager(MyShiroCasRealm myShiroCasRealm) {
        DefaultWebSecurityManager dwsm = new DefaultWebSecurityManager();
        dwsm.setRealm(myShiroCasRealm);
//      <!-- 用户授权/认证信息Cache, 采用EhCache 缓存 -->
        dwsm.setCacheManager(getEhCacheManager());
        // 指定 SubjectFactory
        dwsm.setSubjectFactory(new CasSubjectFactory());
        return dwsm;
    }
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:11,代码来源:ShiroCasConfiguration.java

示例5: defaultWebSecurityManager

import org.apache.shiro.web.mgt.DefaultWebSecurityManager; //导入方法依赖的package包/类
@Bean(name = "securityManager")
public DefaultWebSecurityManager defaultWebSecurityManager(ShiroCasRealm realm){
	DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
	securityManager.setRealm(realm);
	// 指定SubjectFactory
	securityManager.setSubjectFactory(new CasSubjectFactory());
	securityManager.setSessionManager(this.sessionManager());
	securityManager.setCacheManager(this.redisCacheManager());
	return securityManager;
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:11,代码来源:ShiroCasConfig.java

示例6: securityManager

import org.apache.shiro.web.mgt.DefaultWebSecurityManager; //导入方法依赖的package包/类
/**
    * 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;
}
 
开发者ID:hsj-xiaokang,项目名称:springboot-shiro-cas-mybatis,代码行数:17,代码来源:ShiroConfiguration.java


注:本文中的org.apache.shiro.web.mgt.DefaultWebSecurityManager.setSubjectFactory方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。