Validation:
//2. Processing -- -- a matter of account different ground log in, later users need to do optimization, such as login with cas
DefaultWebSecurityManager securityManager=(DefaultWebSecurityManager) the SecurityUtils. GetSecuri tyManager ();
DefaultwebSessionManager our sessionManager=(DefaultwebSessionManager) securityManager. GetSessionManager ();//get the current logged-in user session list
Collection
For (Session Session: sessions) {
//to find whether there is a current login account records, have and then remove the user login to save the session before
The object obj=session. The getAttribute (DefaultSubjectContext PRINCIPALS_ SESSION_ KEY);
In the second transformation question of the code is that wrong phone text transfer images might be a little small mistake mainly don't know why the type conversion error
This is a mistake
Org, apache shiro. Web. Session. MGT. Serv1etContainerSessionManager always be cast to org.. Apache shiro. Web. Session. MGT. DefaultWebSessionManagernfigure. UserRealm. DoGetAuthenticationInfo (UserRealm. Java: 71) ~ (classes/: na)
Configure shiro class
//? Г
@ Bean
Public ShiroFilterFactoryBean getShiroFilterFactoryBean @ the Qualifier (" manager ") DefaultWebSecurityManager managShiroF ilterFactoryBean bean=new ShiroF ilterFactoryBean ();
//set the security manager
Bean. SetSecurityManager (manager);
//add shiro built-in filters
/*
Anon: FR ihiRTJi5jD
Authc: must witness the オ can like to
User: must have to remember I generally don't
Perms. Have access to a resource permissions to
* role: have a role to access
Map
FilterMap. Put ("/writer/* ", "authc");
FilterMap. Put ("/logout ", "logout");
Bean. SetFilterChainDefinitionMap (filterMap);
Bean. SetLoginUrl ("/");
Bean. SetUnauthorizedUrl ("/"); Return the bean;
//manager
@ Bean (name="manager")
Public DefaultWebSecurityManager getDefaultWebSecurityManager @ the Qualifier (" userRealm ") userRealm realm) fDefaultWebSecurityManager securityManager=new DefaultWebSecurityManager ();
//I realm
SecurityManager. SetRealm (realm);
Return the securityManager;