All,
I am using the JDBC Attribute Repository to query a Postgresql database. Amongst others, the query returns two columns that represent arrays, which are transformed into the
PgArray class by the JDBC driver.
The Person Directory works fine with this as I can see from the array items appearing in the log (profile attributes groups and services):
2018-11-14 21:11:00,128 DEBUG [org.apereo.cas.authentication.principal.resolvers.PersonDirectoryPrincipalResolver] - <Retrieved [9] attribute(s) from the repository>
2018-11-14 21:11:00,128 DEBUG [org.apereo.cas.authentication.principal.resolvers.PersonDirectoryPrincipalResolver] - <Found attribute [username] with value(s) [[johndoe]]>
2018-11-14 21:11:00,128 DEBUG [org.apereo.cas.authentication.principal.resolvers.PersonDirectoryPrincipalResolver] - <Found attribute [givenname] with value(s) [[John]]>
2018-11-14 21:11:00,128 DEBUG [org.apereo.cas.authentication.principal.resolvers.PersonDirectoryPrincipalResolver] - <Found attribute [groups] with value(s) [[{admins,test-gruppe}]]>
2018-11-14 21:11:00,128 DEBUG [org.apereo.cas.authentication.principal.resolvers.PersonDirectoryPrincipalResolver] - <Found attribute [services] with value(s) [[{confluence,jira,seafile}]]>
2018-11-14 21:11:00,128 DEBUG [org.apereo.cas.authentication.principal.resolvers.PersonDirectoryPrincipalResolver] - <Found attribute [fullname] with value(s) [[John Doe]]>
2018-11-14 21:11:00,128 DEBUG [org.apereo.cas.authentication.principal.resolvers.PersonDirectoryPrincipalResolver] - <Found attribute [lastname] with value(s) [[Doe]]>
However, the Ticket Granting / Ticket Registry crashes (see line 198 of the attached log) when trying to encode the ticket: Caused by: java.io.NotSerializableException: org.postgresql.jdbc.PgArray (see line 158 of attached log). The PgArray class is indeed not implementing the Serializable interface (see link to code above).
So, here are my questions
- Is this an error that can / should be fixed or at least dealt with on the CAS side?
- Is there a way to work around this, i.e. avoid the situation of using PgArray? I could easily adjust the database to return a plain String with the array items concatenated. But how would tell CAS then to split this and transform this String to a non-harmful, nicely serializable, multi-valued attribute? I need the individual values later-on to control service access.
Regards,
Martin