Авторизация CAS через MongoDB (докер)

Я использую сервер CAS и mongoDB в контейнерах, и я пытаюсь войти в CAS, но получаю сообщение об ошибке (пользователь не аутентифицирован). Контейнеры для CAS и mongoDB находятся в одной сети "cas_net"

2018-11-08 20:54:13,595 DEBUG [org.apereo.cas.authentication.PolicyBasedAuthenticationManager] - <[MongoAuthenticationHandler] exception details: [Failed to validate credentials: Timed out after 30000 ms while waiting for a server that matches ReadPreferenceServerSelector{readPreference=primary}. Client view of cluster state is {type=UNKNOWN, servers=[{address=172.18.0.3:27017, type=UNKNOWN, state=CONNECTING, exception = {com.mongodb.MongoSecurityException: Exception authenticating MongoCredential{mechanism=null, userName='root', source='cas', password=<hidden>, mechanismProperties = {}}}, caused by {com.mongodb.MongoCommandException: Command failed with error 18: 'Authentication failed.' on server 172.18.0.3:27017. The full response is { "ok" : 0.0, "errmsg" : "Authentication failed.", "code" : 18, "codeName" : "AuthenticationFailed" }}}]].>
2018-11-08 20:54:13,597 ERROR [org.apereo.cas.authentication.PolicyBasedAuthenticationManager] - <Authentication has failed. Credentials may be incorrect or CAS cannot find authentication handler that supports [casuser] of type [UsernamePasswordCredential].>
2018-11-08 20:54:13,601 INFO [org.apereo.inspektr.audit.support.Slf4jLoggingAuditTrailManager] - <Audit trail record BEGIN
=============================================================
WHO: casuser
WHAT: Supplied credentials: [casuser]
ACTION: AUTHENTICATION_SUCCESS
APPLICATION: CAS
WHEN: Thu Nov 08 20:54:13 UTC 2018
CLIENT IP ADDRESS: 172.17.0.1
SERVER IP ADDRESS: 172.17.0.4
=============================================================

файл cas.properties

cas.server.name: https://localhost:8443
cas.server.prefix: https://localhost:8443/cas

cas.adminPagesSecurity.ip=127\.0\.0\.1

logging.config: file:/etc/cas/config/log4j2.xml
cas.serviceRegistry.config.location: classpath:/services

#SSL
server.ssl.enable=true
server.ssl.keyStore=file:/etc/cas/thekeystore
server.ssl.keyStorePassword=****
server.ssl.keyPassword=****

#MongoDB Auth
cas.authn.mongo.mongoHostUri=mongodb://root:*****@172.18.0.3:27017/cas
cas.authn.mongo.usernameAttribute=username
cas.authn.mongo.attributes=first_name,last_name
cas.authn.mongo.passwordAttribute=password
cas.authn.mongo.collectionName=users

logging.level.org.apereo=DEBUG
cas.authn.accept.users=
Использование JavaScript и MongoDB
Использование JavaScript и MongoDB
Сегодня я собираюсь вкратце рассказать о прототипах в JavaScript, а также представить и объяснить вам работу с базой данных MongoDB.
0
0
395
1
Перейти к ответу Данный вопрос помечен как решенный

Ответы 1

Ответ принят как подходящий
  • Рассмотрите возможность включения журналов DEBUG для mongodb. В DEBUG вам нужны пакеты org.pac4j, com.mongodb, так что вы можете получить больше информации.
  • Возможно, ваши учетные данные root:***** не найдены в базе данных cas или у них нет необходимых разрешений.

Спасибо за предложение. Я добавил специального пользователя в базу данных mongodb / cas с ролями readWrite и dbAdmin. Я перенастроил подключение к mongoDB в файле cas.properties, и теперь все работает нормально

Bożek Mariusz 12.11.2018 22:25

Другие вопросы по теме