use of org.apache.shiro.web.mgt.DefaultWebSecurityManager in project littlefisher-system by littlefishercoder.
the class ShiroConfig method securityManager.
@Bean
public SecurityManager securityManager() {
DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
securityManager.setRealm(userRealm());
return securityManager;
}
use of org.apache.shiro.web.mgt.DefaultWebSecurityManager in project tesla by linking12.
the class AuthzConfig method securityManager.
@Bean
public SecurityManager securityManager(TeslaUserRealm userRealm) {
DefaultWebSecurityManager manager = new DefaultWebSecurityManager();
manager.setRealm(userRealm);
manager.setCacheManager(getEhCacheManager());
manager.setSessionManager(sessionManager());
return manager;
}
use of org.apache.shiro.web.mgt.DefaultWebSecurityManager in project nutzboot by nutzam.
the class ShiroEnvStarter method getWebSecurityManager.
@IocBean(name = "shiroWebSecurityManager")
public WebSecurityManager getWebSecurityManager() {
DefaultWebSecurityManager webSecurityManager = new DefaultWebSecurityManager() {
protected SubjectContext resolveSession(SubjectContext context) {
if (context.resolveSession() != null) {
return context;
}
try {
Session session = resolveContextSession(context);
if (session != null) {
context.setSession(session);
}
} catch (InvalidSessionException e) {
}
return context;
}
};
// Shiro Session相关
if (conf.getBoolean(PROP_SESSION_ENABLE, true)) {
webSecurityManager.setSessionManager(ioc.get(WebSessionManager.class, "shiroWebSessionManager"));
}
List<Realm> realms = new ArrayList<>();
for (String realmName : ioc.getNamesByType(Realm.class)) {
AuthorizingRealm realm = ioc.get(AuthorizingRealm.class, realmName);
if (conf.getBoolean(PROP_REALM_CACHE_ENABLE, false)) {
realm.setCacheManager(ioc.get(CacheManager.class, "shiroCacheManager"));
}
realms.add(realm);
}
if (ioc.has("authenticationStrategy")) {
ModularRealmAuthenticator modularRealmAuthenticator = new ModularRealmAuthenticator();
modularRealmAuthenticator.setAuthenticationStrategy(ioc.get(AuthenticationStrategy.class, "authenticationStrategy"));
if (realms.size() > 0)
modularRealmAuthenticator.setRealms(realms);
webSecurityManager.setAuthenticator(modularRealmAuthenticator);
}
if (realms.size() > 0)
webSecurityManager.setRealms(realms);
webSecurityManager.setRememberMeManager(ioc.get(RememberMeManager.class, "shiroRememberMeManager"));
return webSecurityManager;
}
use of org.apache.shiro.web.mgt.DefaultWebSecurityManager in project vip by guangdada.
the class ShiroConfig method securityManager.
/**
* 安全管理器
*/
@Bean
public DefaultWebSecurityManager securityManager(CookieRememberMeManager rememberMeManager, CacheManager cacheShiroManager, SessionManager sessionManager) {
DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
securityManager.setRealm(this.shiroDbRealm());
securityManager.setCacheManager(cacheShiroManager);
securityManager.setRememberMeManager(rememberMeManager);
securityManager.setSessionManager(sessionManager);
return securityManager;
}
use of org.apache.shiro.web.mgt.DefaultWebSecurityManager in project spring-boot-examples by ityouknow.
the class ShiroConfig method securityManager.
@Bean
public SecurityManager securityManager() {
DefaultWebSecurityManager securityManager = new DefaultWebSecurityManager();
securityManager.setRealm(myShiroRealm());
return securityManager;
}
Aggregations