Package io.buji.pac4j.realm
Class Pac4jRealm
- java.lang.Object
-
- org.apache.shiro.realm.CachingRealm
-
- org.apache.shiro.realm.AuthenticatingRealm
-
- org.apache.shiro.realm.AuthorizingRealm
-
- io.buji.pac4j.realm.Pac4jRealm
-
- All Implemented Interfaces:
org.apache.shiro.authc.LogoutAware,org.apache.shiro.authz.Authorizer,org.apache.shiro.authz.permission.PermissionResolverAware,org.apache.shiro.authz.permission.RolePermissionResolverAware,org.apache.shiro.cache.CacheManagerAware,org.apache.shiro.lang.util.Initializable,org.apache.shiro.lang.util.Nameable,org.apache.shiro.realm.Realm
public class Pac4jRealm extends org.apache.shiro.realm.AuthorizingRealmRealm based on pac4j token (authentication has already occurred).- Since:
- 2.0.0
- Author:
- Jerome Leleu
-
-
Constructor Summary
Constructors Constructor Description Pac4jRealm()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected org.apache.shiro.authc.AuthenticationInfodoGetAuthenticationInfo(org.apache.shiro.authc.AuthenticationToken authenticationToken)protected org.apache.shiro.authz.AuthorizationInfodoGetAuthorizationInfo(org.apache.shiro.subject.PrincipalCollection principals)StringgetPrincipalNameAttribute()Returns the name of the attribute from CommonProfile that will be used as the value for the principal name.voidsetPrincipalNameAttribute(String principalNameAttribute)Sets the name of the attribute from the CommonProfile that should be returned as the principal name.-
Methods inherited from class org.apache.shiro.realm.AuthorizingRealm
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, setRolePermissionResolver
-
Methods inherited from class org.apache.shiro.realm.AuthenticatingRealm
assertCredentialsMatch, clearCachedAuthenticationInfo, getAuthenticationCache, getAuthenticationCacheKey, getAuthenticationCacheKey, getAuthenticationCacheName, getAuthenticationInfo, getAuthenticationTokenClass, getCredentialsMatcher, init, isAuthenticationCachingEnabled, isAuthenticationCachingEnabled, setAuthenticationCache, setAuthenticationCacheName, setAuthenticationCachingEnabled, setAuthenticationTokenClass, setCredentialsMatcher, supports
-
Methods inherited from class org.apache.shiro.realm.CachingRealm
clearCache, getAvailablePrincipal, getCacheManager, getName, isCachingEnabled, onLogout, setCacheManager, setCachingEnabled
-
-
-
-
Method Detail
-
getPrincipalNameAttribute
public String getPrincipalNameAttribute()
Returns the name of the attribute from CommonProfile that will be used as the value for the principal name.- Returns:
- an attribute name or null
-
setPrincipalNameAttribute
public void setPrincipalNameAttribute(String principalNameAttribute)
Sets the name of the attribute from the CommonProfile that should be returned as the principal name. Common attribute names include "email", "username" or "display_name" but valid values are ultimately determined by the Pac4j client and the profile that it returns. A null or blank string provided for the attribute name will cause the principal to return CommonProfile.getId() as the name.- Parameters:
principalNameAttribute- The attribute name to return. Null or blank will result in CommonProfile.getId() being used for the principal name.- See Also:
Pac4jPrincipal.getName(),CommonProfile
-
doGetAuthenticationInfo
protected org.apache.shiro.authc.AuthenticationInfo doGetAuthenticationInfo(org.apache.shiro.authc.AuthenticationToken authenticationToken) throws org.apache.shiro.authc.AuthenticationException- Specified by:
doGetAuthenticationInfoin classorg.apache.shiro.realm.AuthenticatingRealm- Throws:
org.apache.shiro.authc.AuthenticationException
-
doGetAuthorizationInfo
protected org.apache.shiro.authz.AuthorizationInfo doGetAuthorizationInfo(org.apache.shiro.subject.PrincipalCollection principals)
- Specified by:
doGetAuthorizationInfoin classorg.apache.shiro.realm.AuthorizingRealm
-
-