org.jenkinsci.plugins.cas.spring
Class CasEventListener

java.lang.Object
  extended by org.jenkinsci.plugins.cas.spring.CasEventListener
All Implemented Interfaces:
EventListener, org.springframework.context.ApplicationListener

public class CasEventListener
extends Object
implements org.springframework.context.ApplicationListener

Listener for successful CAS authentication events, that maps Spring Security Authentication to Acegi Security and syncs attributes with the corresponding Jenkins User.

Author:
Fabien Crespel

Field Summary
static String DEFAULT_EMAIL_ATTRIBUTE
           
static String DEFAULT_FULL_NAME_ATTRIBUTE
           
 
Constructor Summary
CasEventListener()
           
 
Method Summary
protected  void copyToAcegiContext(org.springframework.security.cas.authentication.CasAuthenticationToken casToken)
          Map a Spring Security CAS authentication token into the Acegi SecurityContext.
protected  String getAttributeValue(org.springframework.security.cas.authentication.CasAuthenticationToken authToken, String attributeName)
          Retrieve an attribute's value from a CAS authentication token.
 String getEmailAttribute()
          Get the email address attribute name.
 String getFullNameAttribute()
          Get the full name attribute name.
 void onApplicationEvent(org.springframework.context.ApplicationEvent event)
          Handle an application event.
protected  void onSuccessfulAuthentication(org.springframework.security.core.Authentication authentication)
          Successful authentication event handler.
 void setEmailAttribute(String emailAttribute)
          Set the email address attribute name.
 void setFullNameAttribute(String fullNameAttribute)
          Set the full name attribute name.
protected  void syncUserAttributes(org.springframework.security.cas.authentication.CasAuthenticationToken casToken)
          Sync user attributes with a CAS authentication token.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_FULL_NAME_ATTRIBUTE

public static final String DEFAULT_FULL_NAME_ATTRIBUTE
See Also:
Constant Field Values

DEFAULT_EMAIL_ATTRIBUTE

public static final String DEFAULT_EMAIL_ATTRIBUTE
See Also:
Constant Field Values
Constructor Detail

CasEventListener

public CasEventListener()
Method Detail

onApplicationEvent

public void onApplicationEvent(org.springframework.context.ApplicationEvent event)
Handle an application event.

Specified by:
onApplicationEvent in interface org.springframework.context.ApplicationListener
Parameters:
event - the event to respond to

onSuccessfulAuthentication

protected void onSuccessfulAuthentication(org.springframework.security.core.Authentication authentication)
Successful authentication event handler.

Parameters:
authentication - the successful authentication object

copyToAcegiContext

protected void copyToAcegiContext(org.springframework.security.cas.authentication.CasAuthenticationToken casToken)
Map a Spring Security CAS authentication token into the Acegi SecurityContext.

Parameters:
casToken - CAS authentication token

syncUserAttributes

protected void syncUserAttributes(org.springframework.security.cas.authentication.CasAuthenticationToken casToken)
                           throws IOException
Sync user attributes with a CAS authentication token.

Parameters:
casToken - CAS authentication token
Throws:
IOException

getAttributeValue

protected String getAttributeValue(org.springframework.security.cas.authentication.CasAuthenticationToken authToken,
                                   String attributeName)
Retrieve an attribute's value from a CAS authentication token.

Parameters:
authToken - CAS authentication token
attributeName - attribute name
Returns:
attribute value or null if not found

getFullNameAttribute

public String getFullNameAttribute()
Get the full name attribute name.

Returns:
full name attribute name.

setFullNameAttribute

public void setFullNameAttribute(String fullNameAttribute)
Set the full name attribute name.

Parameters:
fullNameAttribute - full name attribute name.

getEmailAttribute

public String getEmailAttribute()
Get the email address attribute name.

Returns:
email address attribute name.

setEmailAttribute

public void setEmailAttribute(String emailAttribute)
Set the email address attribute name.

Parameters:
emailAttribute - email address attribute name.


Copyright © 2004-2012. All Rights Reserved.