Apereo Cas Server with MySQL

291 views
Skip to first unread message

Vaggelis K

unread,
Feb 26, 2018, 2:25:41 PM2/26/18
to CAS Community
Hello Misagh,

We are trying to configure apereo cas server with a mysql database. We have successfully managed to setup the connection and fetch all the attributes.
In our case we want the user to login via the email. So we have configured the main auth functionality as shown below.

cas.authn.jdbc.query[0].sql=SELECT * FROM users WHERE email=?
cas.authn.jdbc.query[0].healthQuery=
cas.authn.jdbc.query[0].isolateInternalQueries=false
cas.authn.jdbc.query[0].url=jdbc:mysql://example/cas_server_db
cas.authn.jdbc.query[0].dialect=org.hibernate.dialect.MySQLDialect
cas.authn.jdbc.query[0].user=exampleUser
cas.authn.jdbc.query[0].password=examplePass
cas.authn.jdbc.query[0].driverClass=com.mysql.jdbc.Driver
cas.authn.jdbc.query[0].fieldPassword=password
cas.authn.jdbc.query[0].passwordEncoder.type=org.defrox.bcrypt.BCryptPasswordEncoder
cas.authn.jdbc.query[0].passwordEncoder.characterEncoding=UTF-8
Also we have this and works fine.
cas.authn.attributeRepository.jdbc[0].singleRow=true
cas.authn.attributeRepository.jdbc[0].url=jdbc:mysql://example/cas_server_db
cas.authn.attributeRepository.jdbc[0].sql=SELECT * FROM attributes WHERE {0}
cas.authn.attributeRepository.jdbc[0].requireAllAttributes=true
cas.authn.attributeRepository.jdbc[0].username=email
cas.authn.attributeRepository.jdbc[0].driverClass=com.mysql.jdbc.Driver
cas.authn.attributeRepository.jdbc[0].user=exampleUser
cas.authn.attributeRepository.jdbc[0].password=examplePass
cas.authn.attributeRepository.jdbc[0].dialect=org.hibernate.dialect.MySQLDialect
Our db schema is:

Inline image 1

Our problem is that we want perform the query with users.id = attributes.user_id.

Is this possible and how we have to change the properties configuration to achieve this?

Note that we have already asked on gitter chat and we have informed that this is possible only by overriding the default person directory’s aggregator/cascading functionality.
If this is the only way, how we can achieve that as we use the cas overlay template master and where is the default one?

Thanks in advance.
Auto Generated Inline Image 1

Hehsni

unread,
Sep 13, 2018, 6:20:42 AM9/13/18
to CAS Community
Hi, i wopuld like to ask you about your configuration, i tried tu use it in my cas server 6.00 RC3, and it seems to work but i have a problem about the authentification, when i put the mail and password i have the message "Authentication source is a required field", do you know why i have this message ?

2018-09-13 12_15_57-Connexion IRHT - CAS – Central Authentication Service.png

My configurations is in the /webapps/cas/WEB-INF/classes/applications.properties

My catalina.out says :

2018-09-13 12_17_20-SRV-IRHT-CAS.png



and the debug :


2018-09-13 12_19_14-SRV-IRHT-CAS.png



Please help me i don't understand at all what is the problem....

Nam Vũ

unread,
Aug 10, 2020, 12:26:58 PM8/10/20
to CAS Community
hi Vaggelis K. I cannot configure cas server to connect to mysql.help please

Vào 02:25:41 UTC+7 Thứ Ba, ngày 27 tháng 2 năm 2018, Vaggelis K đã viết:
Xin chào Misagh,

Chúng tôi đang cố gắng cấu hình máy chủ cas apereo với cơ sở dữ liệu mysql. Chúng tôi đã quản lý thành công thiết lập kết nối và tìm nạp tất cả các thuộc tính.
Trong trường hợp của chúng tôi, chúng tôi muốn người dùng đăng nhập qua email. Vì vậy, chúng tôi đã cấu hình chức năng xác thực chính như hình dưới đây.

cas.authn.jdbc.query [0] .sql = SE LECT * TỪ người dùng WHERE email =? 
cas.authn.jdbc.query [0]. healthQuery =
cas.authn.jdbc.query [0]. isolateInternalQueries = false
cas.authn.jdbc.query [0] .url = jd bc: mysql: // example / cas_server_ db
cas.authn.jdbc.query [0]. dialect = org.hibernate.dialect. MySQLDialect
cas.authn.jdbc.query [0] .user = exampleUser cas.authn.jdbc.query [0]. password = examplePass cas.authn.jdbc.query [0]. driverClass =com.mysql.jdbc. Người lái xe


cas.authn.jdbc.query [0]. fieldPassword = password
cas.authn.jdbc.query [0]. passwordEncoder.type = org. defrox.bcrypt. BCryptPasswordEncoder
cas.authn.jdbc.query [0]. passwordEncoder. characterEncoding = UTF-8
Ngoài ra, chúng tôi có cái này và hoạt động tốt.
cas.authn.attributeRepository. jdbc [0] .singleRow = true 
cas.authn.attributeRepository. jdbc [0] .url = jdbc: mysql: // example / cas_server_db
cas.authn.attributeRepository. jdbc [0] .sql = SELECT * FROM thuộc tính WHERE {0} cas.authn.attributeRepository. jdbc [0] .requireAllAttributes = t rue cas.authn.attributeRepository. jdbc [0] .username = email cas.authn.attributeRepository. jdbc [0] .driverClass = com.mysql. jdbc.Driver cas.authn.attributeRepository. jdbc [0] .user = exampleUser




cas.authn.attributeRepository. jdbc [0] .password = examplePass cas.authn.attributeRepository. jdbc [0] .dialect = org.hibernate. phương ngữ.MySQLDialect
Lược đồ db của chúng tôi là:

Hình ảnh nội tuyến 1

Vấn đề của chúng tôi là chúng tôi muốn thực hiện truy vấn với users.id = properties.user_id .

Điều này có khả thi không và chúng ta phải thay đổi cấu hình thuộc tính như thế nào để đạt được điều này?

Lưu ý rằng chúng tôi đã hỏi về trò chuyện gitter và chúng tôi đã thông báo rằng điều này chỉ có thể thực hiện được bằng cách ghi đè chức năng tổng hợp / xếp tầng của thư mục người mặc định.
Nếu đây là cách duy nhất, làm thế nào chúng ta có thể đạt được điều đó khi chúng ta sử dụng tổng thể mẫu lớp phủ cas và mẫu mặc định ở đâu?

Cảm ơn trước.
Reply all
Reply to author
Forward
0 new messages