Package org.apache.shiro.cas
Class CasRealm
- java.lang.Object
-
- org.apache.shiro.realm.CachingRealm
-
- org.apache.shiro.realm.AuthenticatingRealm
-
- org.apache.shiro.realm.AuthorizingRealm
-
- org.apache.shiro.cas.CasRealm
-
- All Implemented Interfaces:
LogoutAware
,Authorizer
,PermissionResolverAware
,RolePermissionResolverAware
,CacheManagerAware
,Realm
,Initializable
,Nameable
@Deprecated public class CasRealm extends AuthorizingRealm
Deprecated.replaced with Shiro integration in buji-pac4j.This realm implementation acts as a CAS client to a CAS server for authentication and basic authorization. This realm functions by inspecting a submittedCasToken
(which essentially wraps a CAS service ticket) and validates it against the CAS server using a configured CASTicketValidator
. ThevalidationProtocol
isCAS
by default, which indicates that a aCas20ServiceTicketValidator
will be used for ticket validation. You can alternatively set orSaml11TicketValidator
of CAS client. It is based onAuthorizingRealm
for both authentication and authorization. User id and attributes are retrieved from the CAS service ticket validation response during authentication phase. Roles and permissions are computed during authorization phase (according to the attributes previously retrieved).- Since:
- 1.2
- See Also:
- buji-pac4j
-
-
Field Summary
Fields Modifier and Type Field Description static String
DEFAULT_REMEMBER_ME_ATTRIBUTE_NAME
Deprecated.static String
DEFAULT_VALIDATION_PROTOCOL
Deprecated.
-
Constructor Summary
Constructors Constructor Description CasRealm()
Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description protected org.jasig.cas.client.validation.TicketValidator
createTicketValidator()
Deprecated.protected AuthenticationInfo
doGetAuthenticationInfo(AuthenticationToken token)
Deprecated.Authenticates a user and retrieves its information.protected AuthorizationInfo
doGetAuthorizationInfo(PrincipalCollection principals)
Deprecated.Retrieves the AuthorizationInfo for the given principals (the CAS previously authenticated user : id + attributes).protected org.jasig.cas.client.validation.TicketValidator
ensureTicketValidator()
Deprecated.String
getCasServerUrlPrefix()
Deprecated.String
getCasService()
Deprecated.String
getDefaultPermissions()
Deprecated.String
getDefaultRoles()
Deprecated.String
getPermissionAttributeNames()
Deprecated.String
getRememberMeAttributeName()
Deprecated.String
getRoleAttributeNames()
Deprecated.String
getValidationProtocol()
Deprecated.protected void
onInit()
Deprecated.Initializes this realm and potentially enables a cache, depending on configuration.void
setCasServerUrlPrefix(String casServerUrlPrefix)
Deprecated.void
setCasService(String casService)
Deprecated.void
setDefaultPermissions(String defaultPermissions)
Deprecated.void
setDefaultRoles(String defaultRoles)
Deprecated.void
setPermissionAttributeNames(String permissionAttributeNames)
Deprecated.void
setRememberMeAttributeName(String rememberMeAttributeName)
Deprecated.void
setRoleAttributeNames(String roleAttributeNames)
Deprecated.void
setValidationProtocol(String validationProtocol)
Deprecated.-
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, 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
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.shiro.util.Initializable
init
-
-
-
-
Field Detail
-
DEFAULT_REMEMBER_ME_ATTRIBUTE_NAME
public static final String DEFAULT_REMEMBER_ME_ATTRIBUTE_NAME
Deprecated.- See Also:
- Constant Field Values
-
DEFAULT_VALIDATION_PROTOCOL
public static final String DEFAULT_VALIDATION_PROTOCOL
Deprecated.- See Also:
- Constant Field Values
-
-
Constructor Detail
-
CasRealm
public CasRealm()
Deprecated.
-
-
Method Detail
-
onInit
protected void onInit()
Deprecated.Description copied from class:AuthorizingRealm
Initializes this realm and potentially enables a cache, depending on configuration. When this method is called, the following logic is executed:- If the
cache
property has been set, it will be used to cache the AuthorizationInfo objects returned fromAuthorizingRealm.getAuthorizationInfo(org.apache.shiro.subject.PrincipalCollection)
method invocations. All future calls togetAuthorizationInfo
will attempt to use this cache first to alleviate any potentially unnecessary calls to an underlying data store. - If the
cache
property has not been set, thecacheManager
property will be checked. If acacheManager
has been set, it will be used to create an authorizationcache
, and this newly created cache which will be used as specified in #1. - If neither the
(org.apache.shiro.cache.Cache) cache
orcacheManager
properties are set, caching will be disabled and authorization look-ups will be delegated to subclass implementations for each authorization check.
- Overrides:
onInit
in classAuthorizingRealm
- If the
-
ensureTicketValidator
protected org.jasig.cas.client.validation.TicketValidator ensureTicketValidator()
Deprecated.
-
createTicketValidator
protected org.jasig.cas.client.validation.TicketValidator createTicketValidator()
Deprecated.
-
doGetAuthenticationInfo
protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException
Deprecated.Authenticates a user and retrieves its information.- Specified by:
doGetAuthenticationInfo
in classAuthenticatingRealm
- Parameters:
token
- the authentication token- Returns:
- an
AuthenticationInfo
object containing account data resulting from the authentication ONLY if the lookup is successful (i.e. account exists and is valid, etc.) - Throws:
AuthenticationException
- if there is an error during authentication.
-
doGetAuthorizationInfo
protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals)
Deprecated.Retrieves the AuthorizationInfo for the given principals (the CAS previously authenticated user : id + attributes).- Specified by:
doGetAuthorizationInfo
in classAuthorizingRealm
- Parameters:
principals
- the primary identifying principals of the AuthorizationInfo that should be retrieved.- Returns:
- the AuthorizationInfo associated with this principals.
- See Also:
SimpleAuthorizationInfo
-
getCasServerUrlPrefix
public String getCasServerUrlPrefix()
Deprecated.
-
setCasServerUrlPrefix
public void setCasServerUrlPrefix(String casServerUrlPrefix)
Deprecated.
-
getCasService
public String getCasService()
Deprecated.
-
setCasService
public void setCasService(String casService)
Deprecated.
-
getValidationProtocol
public String getValidationProtocol()
Deprecated.
-
setValidationProtocol
public void setValidationProtocol(String validationProtocol)
Deprecated.
-
getRememberMeAttributeName
public String getRememberMeAttributeName()
Deprecated.
-
setRememberMeAttributeName
public void setRememberMeAttributeName(String rememberMeAttributeName)
Deprecated.
-
getDefaultRoles
public String getDefaultRoles()
Deprecated.
-
setDefaultRoles
public void setDefaultRoles(String defaultRoles)
Deprecated.
-
getDefaultPermissions
public String getDefaultPermissions()
Deprecated.
-
setDefaultPermissions
public void setDefaultPermissions(String defaultPermissions)
Deprecated.
-
getRoleAttributeNames
public String getRoleAttributeNames()
Deprecated.
-
setRoleAttributeNames
public void setRoleAttributeNames(String roleAttributeNames)
Deprecated.
-
getPermissionAttributeNames
public String getPermissionAttributeNames()
Deprecated.
-
setPermissionAttributeNames
public void setPermissionAttributeNames(String permissionAttributeNames)
Deprecated.
-
-