本文整理匯總了Java中org.apache.shiro.web.mgt.DefaultWebSecurityManager.setRealm方法的典型用法代碼示例。如果您正苦於以下問題:Java DefaultWebSecurityManager.setRealm方法的具體用法?Java DefaultWebSecurityManager.setRealm怎麽用?Java DefaultWebSecurityManager.setRealm使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.apache.shiro.web.mgt.DefaultWebSecurityManager
的用法示例。
在下文中一共展示了DefaultWebSecurityManager.setRealm方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getManager
import org.apache.shiro.web.mgt.DefaultWebSecurityManager; //導入方法依賴的package包/類
@Bean("securityManager")
public DefaultWebSecurityManager getManager(Realm realm) {
DefaultWebSecurityManager manager = new DefaultWebSecurityManager();
manager.setRealm(realm);
DefaultSubjectDAO subjectDAO = new DefaultSubjectDAO();
DefaultSessionStorageEvaluator evaluator = new DefaultSessionStorageEvaluator();
evaluator.setSessionStorageEnabled(false);
subjectDAO.setSessionStorageEvaluator(evaluator);
manager.setSubjectDAO(subjectDAO);
return manager;
}
示例2: 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;
}
示例3: 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;
}
示例4: 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;
}
示例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;
}
示例6: 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;
}
示例7: securityManager
import org.apache.shiro.web.mgt.DefaultWebSecurityManager; //導入方法依賴的package包/類
/**
* 聲明SecurityManager
* @param myRealm
* @return
*/
@Bean(name="securityManager")
public SecurityManager securityManager(@Qualifier("myRealm") MyRealm myRealm) {
System.out.println("加載shiro");
DefaultWebSecurityManager manager=new DefaultWebSecurityManager();
manager.setRealm(myRealm);
return manager;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例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;
}
示例14: 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;
}
示例15: securityManager
import org.apache.shiro.web.mgt.DefaultWebSecurityManager; //導入方法依賴的package包/類
@Bean
public SecurityManager securityManager(net.sf.ehcache.CacheManager cacheManager, SessionManager sessionManager, MyRealm myRealm) {
DefaultWebSecurityManager sm = new DefaultWebSecurityManager();
registLoggingAuthenticationListener(sm);
//
EhCacheManager cm = new EhCacheManager();
cm.setCacheManager(cacheManager);
sm.setCacheManager(cm);
sm.setSessionManager(sessionManager);
// realm.
Preconditions.checkNotNull(myRealm);
sm.setRealm(myRealm);
//
return sm;
}