I enabled MongoDB Authentification as per the documentation. 

1 ) I added the following to the POM


<dependency>
    <groupId>org.apereo.cas</groupId>
    <artifactId>cas-server-support-mongo</artifactId>
    <version>${cas.version}</version>
</dependency>


2) Included the following properties

#
# Mongo DB Authentication
#

*cas.authn.mongo.mongoHostUri=mongodb://cas:*******@cas-mongo/cas-mongo-database*















*cas.authn.mongo.usernameAttribute=usernamecas.authn.mongo.attributes=first_name,last_namecas.authn.mongo.passwordAttribute=passwordcas.authn.mongo.collectionName=users#cas.authn.mongo.name=#
 
cas.authn.mongo.principalTransformation.suffix=cas.authn.mongo.principalTransformation.caseConversion=NONE#
 cas.authn.mongo.principalTransformation.prefix=# 
cas.authn.mongo.passwordEncoder.type=NONE|DEFAULT|STANDARD|BCRYPT|SCRYPT|PBKDF2|com.example.CustomPasswordEncodercas.authn.mongo.passwordEncoder.type=DEFAULTcas.authn.mongo.passwordEncoder.characterEncoding=UTF-8cas.authn.mongo.passwordEncoder.encodingAlgorithm=SHA-256#
 cas.authn.mongo.passwordEncoder.secret=*Server starts normally and User is 
authenticated. However, when I connect to /cas/status/ssosessions and expand 
the session of the logged in user, the principal attributes field is empty. 
I would expect it to contain first_name and last_name as per the configuration 
and the data in the database. 

The users collection in the database looks like this:

> db.users.find()

{ "_id" : ObjectId("594bc3c32d5c8c3cf244f3bb"), "username" : "casuser", 
"password" : "****", "first_name" : "Cas", "last_name" : "User" }

Also, if I comment out the *cas.authn.mongo.attributes *property, users can no 
longer be authenticated because of a NullPointerException. 

-- 
- CAS gitter chatroom: https://gitter.im/apereo/cas
- CAS mailing list guidelines: https://apereo.github.io/cas/Mailing-Lists.html
- CAS documentation website: https://apereo.github.io/cas
- CAS project website: https://github.com/apereo/cas
--- 
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/5e4f8fa4-613c-4a0c-852d-1d00b718d415%40apereo.org.

Reply via email to