Авторизация CAS через MongoDB (докер) - PullRequest
0 голосов
/ 09 ноября 2018

Я использую сервер 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=

1 Ответ

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