Skip to content
This repository has been archived by the owner on Nov 3, 2017. It is now read-only.

Accept an Email Address as the User Id on Login

mmoayyed edited this page Aug 30, 2012 · 2 revisions

To allow the CAS login to accept an email address in the form of name@domain.xyz from authenticating users and subsequently, transform it back to the actual principal id using only the userid section of the email address (i.e. name), use an instance of the EmailAddressToPrincipalNameTransformer with your authentication handler.

Note: Your authentication handler must be in the object hierarchy of AbstractUsernamePasswordAuthenticationHandler.

Example:

<bean class="org.jasig.cas.authentication.handler.support.SimpleTestUsernamePasswordAuthenticationHandler" >
   <property name="principalNameTransformer">
      <bean class="net.unicon.cas.addons.authentication.handler.EmailAddressToPrincipalNameTransformer" >
   </property>
</bean>

You also should use an instance of EmailAddressPasswordCredentialsToPrincipalResolver:

<bean class="net.unicon.cas.addons.authentication.principal.EmailAddressPasswordCredentialsToPrincipalResolver" >
    <property name="attributeRepository" ref="attributeRepository" />
</bean>
Clone this wiki locally