SQL Exception with SingleRowJdbcPersonAttributeDao (probably configuration error)

54 views
Skip to first unread message

Mate Gabri

unread,
Dec 4, 2016, 8:02:26 PM12/4/16
to CAS Community
Hi,

since I am just getting acquainted with CAS I am certain that my issue is configuration or concept related, so first of all I would like to seek the guidance of the community on how to properly configure the stack the way I thought so, if that is possible at all.

I started out with CAS 5.0.0 using the Maven overlay and configured the Trusted authentication webflow, since Apache handles the authentication in a standardized way throughout the company. The username gets resolved, the login works on the /cas-login page.

Next I wanted to extend the platform with attribute resolution, but apparently this part is not working. 

I created a simple MySQL users table in the cas database like the following:

+--------+------------+-----------+----------------------------+
| uid    | first_name | last_name | email                      |
+--------+------------+-----------+----------------------------+
| mgabri | Mate       | Gabri     | mate.gabri@[obscured]      |
+--------+------------+-----------+----------------------------+

The relecant cas.properties settings are the following, which may be the first source of error:

cas.authn.attributeRepository.jdbc.singleRow=true
cas.authn.attributeRepository.jdbc.requireAllAttributes=true

cas.authn.attributeRepository.jdbc.sql=SELECT * FROM users WHERE {0}
cas.authn.attributeRepository.jdbc.username=uid
cas.authn.attributeRepository.jdbc.url=[obscured]
cas.authn.attributeRepository.jdbc.driverClass=com.mysql.cj.jdbc.Driver
cas.authn.attributeRepository.jdbc.user=[obscured]
cas.authn.attributeRepository.jdbc.password=[obscured]

In the logs I can catch the following lines:

Dec  5 11:06:31 [obscured] CAS: PrincipalBearingCredentialsAuthenticationHandler successfully authenticated mgabri
Dec  5 11:06:31 [obscured] CAS: Executing prepared SQL query
Dec  5 11:06:31 [obscured] CAS: Executing prepared SQL statement [SELECT * FROM users WHERE uid = ?]
Dec  5 11:06:31 [obscured] CAS: Fetching JDBC Connection from DataSource
Dec  5 11:06:32 [obscured] CAS: Recovering From Exception thrown by 'org.apereo.services.persondir.support.jdbc.SingleRowJdbcPersonAttributeDao@431b08dc'
Dec  5 11:06:32 [obscured] CAS: Authenticated principal [mgabri] and attributes {} with credentials [mgabri].

As you can see the SingleRowJdbcPersonAttributeDao is recovering from an exception, but I was not able to figure out a way to have more insight in what is really happening. Unfortunately I am not familiar with Java applications at all so it is a bit hard for me to even start to look for solution.

I would like to humbly ask the community to provide me some guidance on how to proceed or enlighten me that what I want to achieve is possible at all.

I have attached the pom.xml since that is a bit long.

Kind regards,
Mate
pom.xml

Mate Gabri

unread,
Dec 5, 2016, 9:44:35 PM12/5/16
to CAS Community
Figured it out. Stupid me. I am using MariaDB as the SQL backend and configured the MySQL driver instead of the MariDB one. After cleaning this up everything started to work.

Nicolas Scaut

unread,
Apr 12, 2017, 3:34:23 AM4/12/17
to CAS Community, gabri...@modernbiztonsag.org
Hello

Do you solve the problem ?

Because I try to use MySQL for authentification and to retreive attributes.
Auth works but I can't retrieve any attributes

Can you help me ?

Thanks
Reply all
Reply to author
Forward
0 new messages