@Service
public class UserRealm
extends org.apache.shiro.realm.AuthorizingRealm
| Constructor and Description |
|---|
UserRealm(UserMapper userMapper,
RoleMapper roleMapper,
PermissionMapper permissionMapper) |
| Modifier and Type | Method and Description |
|---|---|
protected org.apache.shiro.authc.AuthenticationInfo |
doGetAuthenticationInfo(org.apache.shiro.authc.AuthenticationToken authenticationToken)
默认使用此方法进行用户名正确与否验证,错误抛出异常即可。
|
protected org.apache.shiro.authz.AuthorizationInfo |
doGetAuthorizationInfo(org.apache.shiro.subject.PrincipalCollection principalCollection)
只有当需要检测用户权限的时候才会调用此方法,例如checkRole,checkPermission之类的
|
boolean |
supports(org.apache.shiro.authc.AuthenticationToken authenticationToken)
大坑,必须重写此方法,不然Shiro会报错
|
afterCacheManagerSet, checkPermission, checkPermission, checkPermission, checkPermissions, checkPermissions, checkPermissions, checkRole, checkRole, checkRoles, checkRoles, checkRoles, clearCachedAuthorizationInfo, doClearCache, getAuthorizationCache, getAuthorizationCacheKey, getAuthorizationCacheName, getAuthorizationInfo, getPermissionResolver, getPermissions, getRolePermissionResolver, hasAllRoles, hasRole, hasRole, hasRoles, hasRoles, isAuthorizationCachingEnabled, isPermitted, isPermitted, isPermitted, isPermitted, isPermitted, isPermitted, isPermittedAll, isPermittedAll, isPermittedAll, onInit, setAuthorizationCache, setAuthorizationCacheName, setAuthorizationCachingEnabled, setName, setPermissionResolver, setRolePermissionResolverassertCredentialsMatch, clearCachedAuthenticationInfo, getAuthenticationCache, getAuthenticationCacheKey, getAuthenticationCacheKey, getAuthenticationCacheName, getAuthenticationInfo, getAuthenticationTokenClass, getCredentialsMatcher, init, isAuthenticationCachingEnabled, isAuthenticationCachingEnabled, setAuthenticationCache, setAuthenticationCacheName, setAuthenticationCachingEnabled, setAuthenticationTokenClass, setCredentialsMatcherclearCache, getAvailablePrincipal, getCacheManager, getName, isCachingEnabled, onLogout, setCacheManager, setCachingEnabled@Autowired public UserRealm(UserMapper userMapper, RoleMapper roleMapper, PermissionMapper permissionMapper)
public boolean supports(org.apache.shiro.authc.AuthenticationToken authenticationToken)
supports in interface org.apache.shiro.realm.Realmsupports in class org.apache.shiro.realm.AuthenticatingRealmprotected org.apache.shiro.authz.AuthorizationInfo doGetAuthorizationInfo(org.apache.shiro.subject.PrincipalCollection principalCollection)
doGetAuthorizationInfo in class org.apache.shiro.realm.AuthorizingRealmprotected org.apache.shiro.authc.AuthenticationInfo doGetAuthenticationInfo(org.apache.shiro.authc.AuthenticationToken authenticationToken)
throws org.apache.shiro.authc.AuthenticationException
doGetAuthenticationInfo in class org.apache.shiro.realm.AuthenticatingRealmorg.apache.shiro.authc.AuthenticationExceptionCopyright © 2020 Pivotal Software, Inc.. All rights reserved.