當前位置: 首頁>>代碼示例>>Java>>正文


Java DefaultWebSecurityManager.setCacheManager方法代碼示例

本文整理匯總了Java中org.apache.shiro.web.mgt.DefaultWebSecurityManager.setCacheManager方法的典型用法代碼示例。如果您正苦於以下問題:Java DefaultWebSecurityManager.setCacheManager方法的具體用法?Java DefaultWebSecurityManager.setCacheManager怎麽用?Java DefaultWebSecurityManager.setCacheManager使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.apache.shiro.web.mgt.DefaultWebSecurityManager的用法示例。


在下文中一共展示了DefaultWebSecurityManager.setCacheManager方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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包/類
/**
 * Creates the security manager without registering it.
 * 
 * @param repo  the component repository, only used to register secondary items like lifecycle, not null
 * @param pwService  the password service, not null
 * @return the security manager, not null
 */
protected SecurityManager createSecurityManager(ComponentRepository repo, PasswordService pwService) throws IOException {
  // password matcher
  PasswordMatcher pwMatcher = new PasswordMatcher();
  pwMatcher.setPasswordService(pwService);
  // user database realm
  UserSource userSource = getUserSource();
  if (userSource == null) {
    userSource = getUserMaster();
  }
  UserSourceRealm realm = new UserSourceRealm(userSource);
  realm.setAuthenticationCachingEnabled(true);
  realm.setAuthorizationCachingEnabled(true);
  realm.setCredentialsMatcher(pwMatcher);
  realm.setPermissionResolver(AuthUtils.getPermissionResolver());
  // security manager
  DefaultWebSecurityManager sm = new DefaultWebSecurityManager();
  sm.setRealm(realm);
  sm.setAuthorizer(realm);  // replace ModularRealmAuthorizer as not needed
  sm.setCacheManager(new MemoryConstrainedCacheManager());
  return sm;
}
 
開發者ID:DevStreet,項目名稱:FinanceAnalytics,代碼行數:29,代碼來源:ShiroSecurityComponentFactory.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(@Qualifier("shiroRealm") ShiroRealm realm){
	DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
	securityManager.setRealm(realm);
	// 指定SubjectFactory
	securityManager.setSessionManager(this.sessionManager());
	securityManager.setCacheManager(this.redisCacheManager());
	return securityManager;
}
 
開發者ID:hsj-xiaokang,項目名稱:springboot-shiro-cas-mybatis,代碼行數:10,代碼來源:ShiroConfig.java

示例6: 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

示例7: getDefaultWebSecurityManager

import org.apache.shiro.web.mgt.DefaultWebSecurityManager; //導入方法依賴的package包/類
@Bean(name = "securityManager")
    public DefaultWebSecurityManager getDefaultWebSecurityManager(
            SystemAuthorizingRealm myShiroRealm,
            DefaultWebSessionManager sessionManager,
            EhCacheManager shiroCacheManager) {
        DefaultWebSecurityManager dwsm = new DefaultWebSecurityManager();
        dwsm.setRealm(myShiroRealm);
        dwsm.setSessionManager(sessionManager);
//      <!-- 用戶授權/認證信息Cache, 采用EhCache 緩存 -->
        dwsm.setCacheManager(shiroCacheManager);
        return dwsm;
    }
 
開發者ID:egojit8,項目名稱:easyweb,代碼行數:13,代碼來源:ShiroConfiguration.java

示例8: securitManager

import org.apache.shiro.web.mgt.DefaultWebSecurityManager; //導入方法依賴的package包/類
@Bean(name="securityManager")
public SecurityManager securitManager(@Qualifier("systemRealm")SystemRealm systemRealm, @Qualifier("sessionManager")SessionManager sessionManager, @Qualifier("ehcacheManager")CacheManager cacheManager){
	DefaultWebSecurityManager manager = new DefaultWebSecurityManager();
	manager.setSessionManager(sessionManager);
	//-- 兩種緩存方式: 第一,使用ehcache(shiro自帶的本地內存緩存機製); 第二,使用redis服務進行緩存操作
	manager.setCacheManager(redisCacheManager());
	manager.setRealm(systemRealm);
	return manager;
}
 
開發者ID:ranji1221,項目名稱:lemcloud,代碼行數:10,代碼來源:ShiroConfig.java

示例9: getDefaultWebSecurityManager

import org.apache.shiro.web.mgt.DefaultWebSecurityManager; //導入方法依賴的package包/類
@Bean
public DefaultWebSecurityManager getDefaultWebSecurityManager() {
    DefaultWebSecurityManager dwsm = new DefaultWebSecurityManager();
    dwsm.setRealm(getShiroRealm());
    dwsm.setCacheManager(getCacheManager());
    dwsm.setSessionManager(getSessionManager());
    return dwsm;
}
 
開發者ID:sisyphsu,項目名稱:server-boilerplate,代碼行數:9,代碼來源:ShiroConfig.java

示例10: getDefaultWebSecurityManager

import org.apache.shiro.web.mgt.DefaultWebSecurityManager; //導入方法依賴的package包/類
@Bean(name = "securityManager")
    public DefaultWebSecurityManager getDefaultWebSecurityManager(MyShiroRealm myShiroRealm) {
        DefaultWebSecurityManager dwsm = new DefaultWebSecurityManager();
        dwsm.setRealm(myShiroRealm);
//      <!-- 用戶授權/認證信息Cache, 采用EhCache 緩存 --> 
        dwsm.setCacheManager(getEhCacheManager());
        return dwsm;
    }
 
開發者ID:seagrape,項目名稱:kekoa,代碼行數:9,代碼來源:ShiroConfiguration.java

示例11: getDefaultWebSecurityManager

import org.apache.shiro.web.mgt.DefaultWebSecurityManager; //導入方法依賴的package包/類
@Bean(name = "securityManager")
public DefaultWebSecurityManager getDefaultWebSecurityManager(
		MyShiroRealm myShiroRealm) {
	DefaultWebSecurityManager dwsm = new DefaultWebSecurityManager();
	dwsm.setRealm(myShiroRealm);
	// <!-- 用戶授權/認證信息Cache, 采用EhCache 緩存 -->
	dwsm.setCacheManager(getEhCacheManager());
	return dwsm;
}
 
開發者ID:seagrape,項目名稱:kekoa,代碼行數:10,代碼來源:KekoaShiroConfiguration.java

示例12: webSecurityManager

import org.apache.shiro.web.mgt.DefaultWebSecurityManager; //導入方法依賴的package包/類
@Bean
public DefaultWebSecurityManager webSecurityManager(Realm realm,
                                                    CookieRememberMeManager rememberMeManager,
                                                    DefaultWebSessionManager sessionManager,
                                                    EhCacheManager ehCacheManager) {
    DefaultWebSecurityManager defaultWebSecurityManager = new DefaultWebSecurityManager();
    defaultWebSecurityManager.setRealm(realm);
    defaultWebSecurityManager.setRememberMeManager(rememberMeManager);
    defaultWebSecurityManager.setSessionManager(sessionManager);
    defaultWebSecurityManager.setCacheManager(ehCacheManager);
    return defaultWebSecurityManager;
}
 
開發者ID:izhangzhihao,項目名稱:SpringMVCWithJavaConfig,代碼行數:13,代碼來源:ShiroConfig.java

示例13: getDefaultWebSecurityManager

import org.apache.shiro.web.mgt.DefaultWebSecurityManager; //導入方法依賴的package包/類
@Bean(name = "securityManager")
public DefaultWebSecurityManager getDefaultWebSecurityManager(AuthorizingRealm realm) {
    DefaultWebSecurityManager dwsm = new DefaultWebSecurityManager();
    dwsm.setRealm(realm);
    dwsm.setCacheManager(getEhCacheManager());
    return dwsm;
}
 
開發者ID:fireshort,項目名稱:spring-boot-quickstart,代碼行數:8,代碼來源:ShiroConfiguration.java

示例14: initSecurityManager

import org.apache.shiro.web.mgt.DefaultWebSecurityManager; //導入方法依賴的package包/類
private WebSecurityManager initSecurityManager() {
    AppDbRealm appDbRealm = new AppDbRealm();
    DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager(appDbRealm);
    final EhCacheManager cacheManager = new EhCacheManager();
    cacheManager.setCacheManagerConfigFile("classpath:goja/ehcache/shiro-ehcache.xml");
    securityManager.setCacheManager(cacheManager);
    final DefaultWebSessionManager defaultWebSessionManager = new DefaultWebSessionManager();
    defaultWebSessionManager.setSessionIdCookieEnabled(true);
    // 默認一年過期時間
    final String expiredTimes = shiroConfig.getProperty("session.expired", "10800000");
    defaultWebSessionManager.setGlobalSessionTimeout(MoreObjects.firstNonNull(Ints.tryParse(expiredTimes), 10800000));
    securityManager.setSessionManager(defaultWebSessionManager);
    return securityManager;
}
 
開發者ID:GojaFramework,項目名稱:goja,代碼行數:15,代碼來源:GojaShiroFilter.java

示例15: getDefaultWebSecurityManager

import org.apache.shiro.web.mgt.DefaultWebSecurityManager; //導入方法依賴的package包/類
@Bean(name = "securityManager")
public DefaultWebSecurityManager getDefaultWebSecurityManager() {
	DefaultWebSecurityManager dwsm = new DefaultWebSecurityManager();
	dwsm.setRealm(getShiroRealm());
	dwsm.setCacheManager(getEhCacheManager());
	return dwsm;
}
 
開發者ID:guhao,項目名稱:zo-spring-boot,代碼行數:8,代碼來源:ShiroConfiguration.java


注:本文中的org.apache.shiro.web.mgt.DefaultWebSecurityManager.setCacheManager方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。