Have you tried using a collection of values instead of a single “email”?



From: Jonatha Luthi [mailto:[email protected]]


Sent: Thursday, October 9, 2014 6:48 AM
To: [email protected]
Subject: [cas-user] Cas 4 - sql authentication with username or email and 
retrieve person attribute



Hi,



I'm trying to configure my CAS Server 4 to allow users to authenticate with 
username or email within a mysql database (using JDBC). So, in my 
primaryAuthenticationHandler I set the sql like this:



SELECT password FROM users WHERE LOWER(?) IN (LOWER(username), LOWER(email)) 
AND NOT deleted


It works, but my problem is that I'm using a SingleRowJdbcPersonAttributeDao 
to retrieve user attributes. Something like this:



...

<constructor-arg index="1" value="SELECT ... FROM users WHERE {0}" />

<property name="queryAttributeMapping">

    <map>

      <entry key="username" value="email" />

    </map>

</property>
...


Attributes are retrieved only when user log in with email (because query is 
translated as email=username).

So, I wonder if it's possible to have a query like this "...email=username 
OR username=username".



I really want to have login possible by username or email on my website.



Best regards,

Jonathan




-- 
You are currently subscribed to [email protected] 
<mailto:[email protected]>  as: [email protected] 
<mailto:[email protected]>
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user

-- 
You are currently subscribed to [email protected] as: 
[email protected]
To unsubscribe, change settings or access archives, see 
http://www.ja-sig.org/wiki/display/JSG/cas-user

Reply via email to