public class

CasAuthenticationEntryPoint

extends Object
implements InitializingBean AuthenticationEntryPoint
java.lang.Object
   ↳ org.springframework.security.cas.web.CasAuthenticationEntryPoint

Class Overview

Used by the ExceptionTranslationFilter to commence authentication via the JA-SIG Central Authentication Service (CAS).

The user's browser will be redirected to the JA-SIG CAS enterprise-wide login page. This page is specified by the loginUrl property. Once login is complete, the CAS login page will redirect to the page indicated by the service property. The service is a HTTP URL belonging to the current application. The service URL is monitored by the CasAuthenticationFilter, which will validate the CAS login was successful.

Summary

Public Constructors
CasAuthenticationEntryPoint()
Public Methods
void afterPropertiesSet()
final void commence(HttpServletRequest servletRequest, HttpServletResponse response, AuthenticationException authenticationException)
Commences an authentication scheme.
final String getLoginUrl()
The enterprise-wide CAS login URL.
final ServiceProperties getServiceProperties()
final void setEncodeServiceUrlWithSessionId(boolean encodeServiceUrlWithSessionId)
This method is deprecated. since 3.0.0 because CAS is currently on 3.3.5.
final void setLoginUrl(String loginUrl)
final void setServiceProperties(ServiceProperties serviceProperties)
Protected Methods
String createRedirectUrl(String serviceUrl)
Constructs the Url for Redirection to the CAS server.
String createServiceUrl(HttpServletRequest request, HttpServletResponse response)
Constructs a new Service Url.
boolean getEncodeServiceUrlWithSessionId()
This method is deprecated. since 3.0.0 because CAS is currently on 3.3.5.
void preCommence(HttpServletRequest request, HttpServletResponse response)
Template method for you to do your own pre-processing before the redirect occurs.
[Expand]
Inherited Methods
From class java.lang.Object
From interface org.springframework.beans.factory.InitializingBean
From interface org.springframework.security.web.AuthenticationEntryPoint

Public Constructors

public CasAuthenticationEntryPoint ()

Public Methods

public void afterPropertiesSet ()

Throws
Exception

public final void commence (HttpServletRequest servletRequest, HttpServletResponse response, AuthenticationException authenticationException)

Commences an authentication scheme.

ExceptionTranslationFilter will populate the HttpSession attribute named AbstractAuthenticationProcessingFilter.SPRING_SECURITY_SAVED_REQUEST_KEY with the requested target URL before calling this method.

Implementations should modify the headers on the ServletResponse as necessary to commence the authentication process.

Parameters
servletRequest that resulted in an AuthenticationException
response so that the user agent can begin authentication
authenticationException that caused the invocation
Throws
IOException
ServletException

public final String getLoginUrl ()

The enterprise-wide CAS login URL. Usually something like https://www.mycompany.com/cas/login.

Returns
  • the enterprise-wide CAS login URL

public final ServiceProperties getServiceProperties ()

public final void setEncodeServiceUrlWithSessionId (boolean encodeServiceUrlWithSessionId)

This method is deprecated.
since 3.0.0 because CAS is currently on 3.3.5.

Sets whether to encode the service url with the session id or not.

Parameters
encodeServiceUrlWithSessionId whether to encode the service url with the session id or not.

public final void setLoginUrl (String loginUrl)

public final void setServiceProperties (ServiceProperties serviceProperties)

Protected Methods

protected String createRedirectUrl (String serviceUrl)

Constructs the Url for Redirection to the CAS server. Default implementation relies on the CAS client to do the bulk of the work.

Parameters
serviceUrl the service url that should be included.
Returns
  • the redirect url. CANNOT be NULL.

protected String createServiceUrl (HttpServletRequest request, HttpServletResponse response)

Constructs a new Service Url. The default implementation relies on the CAS client to do the bulk of the work.

Parameters
request the HttpServletRequest
response the HttpServlet Response
Returns
  • the constructed service url. CANNOT be NULL.

protected boolean getEncodeServiceUrlWithSessionId ()

This method is deprecated.
since 3.0.0 because CAS is currently on 3.3.5.

Sets whether to encode the service url with the session id or not.

Returns
  • whether to encode the service url with the session id or not.

protected void preCommence (HttpServletRequest request, HttpServletResponse response)

Template method for you to do your own pre-processing before the redirect occurs.

Parameters
request the HttpServletRequest
response the HttpServletResponse