Java Code Examples for org.apache.shiro.mgt.DefaultSessionStorageEvaluator#setSessionStorageEnabled()

The following examples show how to use org.apache.shiro.mgt.DefaultSessionStorageEvaluator#setSessionStorageEnabled() . 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: ShiroAuthConfig.java    From Moss with Apache License 2.0 6 votes vote down vote up
@Bean("securityManager")
public DefaultWebSecurityManager getManager(UserService userService) {
    DefaultWebSecurityManager manager = new DefaultWebSecurityManager();
    List<Realm> realms = Lists.newArrayList();
    realms.add(new DBRealm(userService));
    manager.setRealms(realms);

    /*
     * 关闭shiro自带的session,详情见文档
     * http://shiro.apache.org/session-management.html#SessionManagement-StatelessApplications%28Sessionless%29
     */
    DefaultSubjectDAO subjectDAO = new DefaultSubjectDAO();
    DefaultSessionStorageEvaluator defaultSessionStorageEvaluator = new DefaultSessionStorageEvaluator();
    defaultSessionStorageEvaluator.setSessionStorageEnabled(false);
    subjectDAO.setSessionStorageEvaluator(defaultSessionStorageEvaluator);
    manager.setSubjectDAO(subjectDAO);

    return manager;
}
 
Example 2
Source File: ShiroConfig.java    From web-flash with MIT License 6 votes vote down vote up
@Bean("securityManager")
public DefaultWebSecurityManager getManager(ApiRealm realm) {
    DefaultWebSecurityManager manager = new DefaultWebSecurityManager();
    // 使用自己的realm
    manager.setRealm(realm);

    /*
     * 关闭shiro自带的session,详情见文档
     * http://shiro.apache.org/session-management.html#SessionManagement-StatelessApplications%28Sessionless%29
     */
    DefaultSubjectDAO subjectDAO = new DefaultSubjectDAO();
    DefaultSessionStorageEvaluator defaultSessionStorageEvaluator = new DefaultSessionStorageEvaluator();
    defaultSessionStorageEvaluator.setSessionStorageEnabled(false);
    subjectDAO.setSessionStorageEvaluator(defaultSessionStorageEvaluator);
    manager.setSubjectDAO(subjectDAO);

    return manager;
}
 
Example 3
Source File: ShiroConfig.java    From flash-waimai with MIT License 6 votes vote down vote up
@Bean("securityManager")
public DefaultWebSecurityManager getManager(ApiRealm realm) {
    DefaultWebSecurityManager manager = new DefaultWebSecurityManager();
    // 使用自己的realm
    manager.setRealm(realm);

    /*
     * 关闭shiro自带的session,详情见文档
     * http://shiro.apache.org/session-management.html#SessionManagement-StatelessApplications%28Sessionless%29
     */
    DefaultSubjectDAO subjectDAO = new DefaultSubjectDAO();
    DefaultSessionStorageEvaluator defaultSessionStorageEvaluator = new DefaultSessionStorageEvaluator();
    defaultSessionStorageEvaluator.setSessionStorageEnabled(false);
    subjectDAO.setSessionStorageEvaluator(defaultSessionStorageEvaluator);
    manager.setSubjectDAO(subjectDAO);

    return manager;
}
 
Example 4
Source File: ShiroConfig.java    From fastdep with Apache License 2.0 5 votes vote down vote up
/**
 * securityManager
 *
 * @param authorizingRealm AuthorizingRealm bean
 * @return securityManager
 */
@Bean("securityManager")
@ConditionalOnMissingBean(SecurityManager.class)
public DefaultWebSecurityManager getManager(AuthorizingRealm authorizingRealm) {
    DefaultWebSecurityManager manager = new DefaultWebSecurityManager();
    manager.setRealm(authorizingRealm);
    DefaultSubjectDAO subjectDAO = new DefaultSubjectDAO();
    DefaultSessionStorageEvaluator defaultSessionStorageEvaluator = new DefaultSessionStorageEvaluator();
    defaultSessionStorageEvaluator.setSessionStorageEnabled(false);
    subjectDAO.setSessionStorageEvaluator(defaultSessionStorageEvaluator);
    manager.setSubjectDAO(subjectDAO);
    return manager;
}