@Component
public class SampleRealm
extends org.apache.shiro.realm.AuthorizingRealm
Because a Realm is really just a security-specific DAO, we could have just made Hibernate calls directly in the implementation and named it a 'HibernateRealm' or something similar.
But we've decided to make the calls to the database using a UserDAO, since a DAO would be used in other areas of a 'real' application in addition to here. We felt it better to use that same DAO to show code re-use.
Constructor and Description |
---|
SampleRealm() |
Modifier and Type | Method and Description |
---|---|
protected org.apache.shiro.authc.AuthenticationInfo |
doGetAuthenticationInfo(org.apache.shiro.authc.AuthenticationToken authcToken) |
protected org.apache.shiro.authz.AuthorizationInfo |
doGetAuthorizationInfo(org.apache.shiro.subject.PrincipalCollection principals) |
void |
setUserDAO(UserDAO userDAO) |
afterCacheManagerSet, checkPermission, checkPermission, checkPermission, checkPermissions, checkPermissions, checkPermissions, checkRole, checkRole, checkRoles, checkRoles, checkRoles, clearCachedAuthorizationInfo, doClearCache, getAuthorizationCache, getAuthorizationCacheKey, getAuthorizationCacheName, getAuthorizationInfo, getPermissionResolver, getRolePermissionResolver, hasAllRoles, hasRole, hasRole, hasRoles, hasRoles, isAuthorizationCachingEnabled, isPermitted, isPermitted, isPermitted, isPermitted, isPermitted, isPermittedAll, isPermittedAll, isPermittedAll, onInit, setAuthorizationCache, setAuthorizationCacheName, setAuthorizationCachingEnabled, setName, setPermissionResolver, setRolePermissionResolver
assertCredentialsMatch, clearCachedAuthenticationInfo, getAuthenticationCache, getAuthenticationCacheKey, getAuthenticationCacheKey, getAuthenticationCacheName, getAuthenticationInfo, getAuthenticationTokenClass, getCredentialsMatcher, init, isAuthenticationCachingEnabled, isAuthenticationCachingEnabled, setAuthenticationCache, setAuthenticationCacheName, setAuthenticationCachingEnabled, setAuthenticationTokenClass, setCredentialsMatcher, supports
clearCache, getAvailablePrincipal, getCacheManager, getName, isCachingEnabled, onLogout, setCacheManager, setCachingEnabled
protected UserDAO userDAO
public void setUserDAO(UserDAO userDAO)
protected org.apache.shiro.authc.AuthenticationInfo doGetAuthenticationInfo(org.apache.shiro.authc.AuthenticationToken authcToken) throws org.apache.shiro.authc.AuthenticationException
doGetAuthenticationInfo
in class org.apache.shiro.realm.AuthenticatingRealm
org.apache.shiro.authc.AuthenticationException
protected org.apache.shiro.authz.AuthorizationInfo doGetAuthorizationInfo(org.apache.shiro.subject.PrincipalCollection principals)
doGetAuthorizationInfo
in class org.apache.shiro.realm.AuthorizingRealm
Copyright © 2015. All rights reserved.