public class CasEventListener extends Object implements org.springframework.context.ApplicationListener<org.springframework.security.authentication.event.AuthenticationSuccessEvent>
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_EMAIL_ATTRIBUTE |
static String |
DEFAULT_FULL_NAME_ATTRIBUTE |
| Constructor and Description |
|---|
CasEventListener() |
| Modifier and Type | Method and Description |
|---|---|
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.security.authentication.event.AuthenticationSuccessEvent event)
Handle an application event.
|
void |
onSuccessfulAuthentication(org.springframework.security.core.Authentication authentication)
Successful authentication event handler.
|
protected String |
parseAttributeTemplate(org.springframework.security.cas.authentication.CasAuthenticationToken authToken,
String attributeTemplate)
Replace placeholders in an attribute template string.
|
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.
|
public static final String DEFAULT_FULL_NAME_ATTRIBUTE
public static final String DEFAULT_EMAIL_ATTRIBUTE
public void onApplicationEvent(org.springframework.security.authentication.event.AuthenticationSuccessEvent event)
onApplicationEvent in interface org.springframework.context.ApplicationListener<org.springframework.security.authentication.event.AuthenticationSuccessEvent>event - the event to respond topublic void onSuccessfulAuthentication(org.springframework.security.core.Authentication authentication)
authentication - the successful authentication objectprotected void syncUserAttributes(org.springframework.security.cas.authentication.CasAuthenticationToken casToken)
throws IOException
casToken - CAS authentication tokenIOExceptionprotected String parseAttributeTemplate(org.springframework.security.cas.authentication.CasAuthenticationToken authToken, String attributeTemplate)
authToken - CAS authentication tokenattributeTemplate - attribute template containing '{{placeholder}}' or plain attribute nameprotected String getAttributeValue(org.springframework.security.cas.authentication.CasAuthenticationToken authToken, String attributeName)
authToken - CAS authentication tokenattributeName - attribute namepublic String getFullNameAttribute()
public void setFullNameAttribute(String fullNameAttribute)
fullNameAttribute - full name attribute name.public String getEmailAttribute()
public void setEmailAttribute(String emailAttribute)
emailAttribute - email address attribute name.Copyright © 2016–2021. All rights reserved.