shiro url pattern problem
This commit is contained in:
+1
-10
@@ -64,17 +64,8 @@ public class ShiroDbRealm extends AuthorizingRealm {
|
||||
*/
|
||||
@Override
|
||||
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
|
||||
Object principal = principals.getPrimaryPrincipal();
|
||||
if (principal == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ShiroUser shiroUser = (ShiroUser) principal;
|
||||
ShiroUser shiroUser = (ShiroUser) principals.getPrimaryPrincipal();
|
||||
User user = accountService.findUserByLoginName(shiroUser.loginName);
|
||||
if (user == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
|
||||
info.addRoles(user.getRoleList());
|
||||
return info;
|
||||
|
||||
@@ -25,9 +25,10 @@
|
||||
<value>
|
||||
/login = authc
|
||||
/logout = logout
|
||||
/static/* = anon
|
||||
/admin/* = roles[admin]
|
||||
/* = user
|
||||
/static/** = anon
|
||||
/api/** = anon
|
||||
/admin/** = roles[admin]
|
||||
/** = user
|
||||
</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
+1
-9
@@ -70,16 +70,8 @@ public class ShiroDbRealm extends AuthorizingRealm {
|
||||
*/
|
||||
@Override
|
||||
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
|
||||
Object principal = principals.getPrimaryPrincipal();
|
||||
if (principal == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
ShiroUser shiroUser = (ShiroUser) principal;
|
||||
ShiroUser shiroUser = (ShiroUser) principals.getPrimaryPrincipal();
|
||||
User user = accountService.findUserByLoginName(shiroUser.loginName);
|
||||
if (user == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
SimpleAuthorizationInfo info = new SimpleAuthorizationInfo();
|
||||
for (Role role : user.getRoleList()) {
|
||||
|
||||
Reference in New Issue
Block a user