Class CasAuthenticationProvider
- All Implemented Interfaces:
org.springframework.beans.factory.Aware,org.springframework.beans.factory.InitializingBean,org.springframework.context.MessageSourceAware,AuthenticationProvider
AuthenticationProvider implementation that integrates with JA-SIG Central
Authentication Service (CAS).
This AuthenticationProvider is capable of validating
CasServiceTicketAuthenticationToken requests which contain a
principal name equal to either
CasServiceTicketAuthenticationToken.CAS_STATEFUL_IDENTIFIER or
CasServiceTicketAuthenticationToken.CAS_STATELESS_IDENTIFIER. It can also
validate a previously created CasAuthenticationToken.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected org.springframework.context.support.MessageSourceAccessor -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidauthenticate(Authentication authentication) Performs authentication with the same contract asAuthenticationManager.authenticate(Authentication).protected StringgetKey()protected org.apereo.cas.client.validation.TicketValidatorprotected UserDetailsloadUserByAssertion(org.apereo.cas.client.validation.Assertion assertion) Template method for retrieving the UserDetails based on the assertion.voidsetAuthenticationUserDetailsService(AuthenticationUserDetailsService<CasAssertionAuthenticationToken> authenticationUserDetailsService) voidsetAuthoritiesMapper(GrantedAuthoritiesMapper authoritiesMapper) voidvoidsetMessageSource(org.springframework.context.MessageSource messageSource) voidsetServiceProperties(ServiceProperties serviceProperties) voidsetStatelessTicketCache(StatelessTicketCache statelessTicketCache) voidsetTicketValidator(org.apereo.cas.client.validation.TicketValidator ticketValidator) voidsetUserDetailsChecker(UserDetailsChecker userDetailsChecker) Sets the UserDetailsChecker to be used for checking the status of retrieved user details.voidsetUserDetailsService(UserDetailsService userDetailsService) booleanReturnstrueif thisAuthenticationProvidersupports the indicatedAuthenticationobject.
-
Field Details
-
messages
protected org.springframework.context.support.MessageSourceAccessor messages
-
-
Constructor Details
-
CasAuthenticationProvider
public CasAuthenticationProvider()
-
-
Method Details
-
afterPropertiesSet
public void afterPropertiesSet()- Specified by:
afterPropertiesSetin interfaceorg.springframework.beans.factory.InitializingBean
-
authenticate
Description copied from interface:AuthenticationProviderPerforms authentication with the same contract asAuthenticationManager.authenticate(Authentication).- Specified by:
authenticatein interfaceAuthenticationProvider- Parameters:
authentication- the authentication request object.- Returns:
- a fully authenticated object including credentials. May return
nullif theAuthenticationProvideris unable to support authentication of the passedAuthenticationobject. In such a case, the nextAuthenticationProviderthat supports the presentedAuthenticationclass will be tried. - Throws:
AuthenticationException- if authentication fails.
-
loadUserByAssertion
Template method for retrieving the UserDetails based on the assertion. Default is to call configured userDetailsService and pass the username. Deployers can override this method and retrieve the user based on any criteria they desire.- Parameters:
assertion- The CAS Assertion.- Returns:
- the UserDetails.
-
setUserDetailsService
-
setAuthenticationUserDetailsService
public void setAuthenticationUserDetailsService(AuthenticationUserDetailsService<CasAssertionAuthenticationToken> authenticationUserDetailsService) -
setUserDetailsChecker
Sets the UserDetailsChecker to be used for checking the status of retrieved user details. This allows customization of the UserDetailsChecker implementation.- Parameters:
userDetailsChecker- the UserDetailsChecker to be set- Since:
- 6.4
-
setServiceProperties
-
getKey
-
setKey
-
getStatelessTicketCache
-
getTicketValidator
protected org.apereo.cas.client.validation.TicketValidator getTicketValidator() -
setMessageSource
public void setMessageSource(org.springframework.context.MessageSource messageSource) - Specified by:
setMessageSourcein interfaceorg.springframework.context.MessageSourceAware
-
setStatelessTicketCache
-
setTicketValidator
public void setTicketValidator(org.apereo.cas.client.validation.TicketValidator ticketValidator) -
setAuthoritiesMapper
-
supports
Description copied from interface:AuthenticationProviderReturnstrueif thisAuthenticationProvidersupports the indicatedAuthenticationobject.Returning
truedoes not guarantee anAuthenticationProviderwill be able to authenticate the presentedAuthenticationobject. It simply indicates it can support closer evaluation of it. AnAuthenticationProvidercan still returnnullfrom theAuthenticationProvider.authenticate(Authentication)method to indicate anotherAuthenticationProvidershould be tried.Selection of an
AuthenticationProvidercapable of performing authentication is conducted at runtime theProviderManager.- Specified by:
supportsin interfaceAuthenticationProvider- Returns:
trueif the implementation can more closely evaluate theAuthenticationclass presented
-