I don't use the jdbc attribute resolver, but the concept is similar to
others. What is your user table schema? You are doing a 'select *', rather
than explicitly listing the columns. Is there a column named firstname? You
are expecting to map a retrieved attribute named 'firstname' to a principal
attribute named firstname, but that will only work if the the database has
columns named exactly as you expect. That could be the source of errors
such as this in your log:

Cannot access indexed value in property referenced in indexed property path
'attributes[firstname]'

-dirk

On Fri, Oct 12, 2018 at 1:30 AM Fahmi L. Ramdhani <
[email protected]> wrote:

> my *cas.properties*:
> ## Database Authentication
> ## ================================================================
> cas.authn.accept.users=
>
>
> cas.authn.jdbc.query[0].sql = SELECT * FROM users WHERE email=?
> cas.authn.jdbc.query[0].healthQuery = SELECT 1
> cas.authn.jdbc.query[0].driverClass = com.mysql.jdbc.Driver
> cas.authn.jdbc.query[0].url = jdbc:mysql:
> //localhost:3306/casdb?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
> cas.authn.jdbc.query[0].user = root
> cas.authn.jdbc.query[0].password = ******
> cas.authn.jdbc.query[0].dialect = org.hibernate.dialect.MySQLDialect
> cas.authn.jdbc.query[0].fieldPassword = password
> cas.authn.jdbc.query[0].passwordEncoder.type = DEFAULT
> cas.authn.jdbc.query[0].passwordEncoder.encodingAlgorithm = MD5
> cas.authn.jdbc.query[0].passwordEncoder.characterEncoding = UTF-8
>
>
> cas.authn.attributeRepository.jdbc[0].sql = SELECT * FROM user_attributes
> WHERE {0}
> cas.authn.attributeRepository.jdbc[0].healthQuery = SELECT 1
> cas.authn.attributeRepository.jdbc[0].driverClass = com.mysql.jdbc.Driver
> cas.authn.attributeRepository.jdbc[0].url = jdbc:mysql:
> //localhost:3306/casdb?useUnicode=true&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=UTC
> cas.authn.attributeRepository.jdbc[0].user = root
> cas.authn.attributeRepository.jdbc[0].password = ******
> cas.authn.attributeRepository.jdbc[0].dialect = org.hibernate.dialect.
> MySQLDialect
> cas.authn.attributeRepository.jdbc[0].singleRow = false
> cas.authn.attributeRepository.jdbc[0].username = email
> cas.authn.attributeRepository.jdbc[0].columnMappings.key=value
>
>
> cas.authn.attributeRepository.jdbc[0].attributes.firstname=firstname
> cas.authn.attributeRepository.defaultAttributesToRelease=firstname
>
>
> my *pom.xml*
>
> <!--
> ...Additional dependencies may be placed here...
> -->
> <dependency>
>  <groupId>org.apereo.cas</groupId>
>  <artifactId>cas-server-support-json-service-registry</artifactId>
>  <version>${cas.version}</version>
> </dependency>
> <dependency>
>  <groupId>org.apereo.cas</groupId>
>  <artifactId>cas-server-support-jdbc</artifactId>
>  <version>${cas.version}</version>
> </dependency>
> <dependency>
>    <groupId>org.apereo.cas</groupId>
>    <artifactId>cas-server-support-jdbc-drivers</artifactId>
>    <version>${cas.version}</version>
> </dependency>
>
>
> When use Laravel with *phpCAS*
> @foreach(cas()->getAttributes() as $attribute)
>  {{ $attribute }}<br>
> @endforeach
>
>
> HTML Result is:
> UsernamePasswordCredential
> false
> 2018-10-12T11:32:35.265+07:00[Asia/Jakarta]
> QueryDatabaseAuthenticationHandler
> QueryDatabaseAuthenticationHandler
> false
>
>
> Based on the configuration above, the attribute does not display data.
> Please give me a solution about this problem. Thank you.
>
> --
> - Website: https://apereo.github.io/cas
> - Gitter Chatroom: https://gitter.im/apereo/cas
> - List Guidelines: https://goo.gl/1VRrw7
> - Contributions: https://goo.gl/mh7qDG
> ---
> You received this message because you are subscribed to the Google Groups
> "CAS Community" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To view this discussion on the web visit
> https://groups.google.com/a/apereo.org/d/msgid/cas-user/23a9e25d-849f-4881-b0ca-7cb068743c15%40apereo.org
> <https://groups.google.com/a/apereo.org/d/msgid/cas-user/23a9e25d-849f-4881-b0ca-7cb068743c15%40apereo.org?utm_medium=email&utm_source=footer>
> .
>

-- 
- Website: https://apereo.github.io/cas
- Gitter Chatroom: https://gitter.im/apereo/cas
- List Guidelines: https://goo.gl/1VRrw7
- Contributions: https://goo.gl/mh7qDG
--- 
You received this message because you are subscribed to the Google Groups "CAS 
Community" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/a/apereo.org/d/msgid/cas-user/CAJ%3D0EZxtSkYnVj5ns8SdN1jNgcwRqfzWxhhKhvQiWzSyc-cNpw%40mail.gmail.com.

Reply via email to