CAS 5.3.2 Service registry with mongo db.

52 views
Skip to first unread message

vivekanand yaram

unread,
Aug 20, 2018, 11:14:37 AM8/20/18
to CAS Community

Hello All,

 

Good morning !  I’m working on a POC to use CAS with our application . So far the POC is going good and I could see that CAS matching all our requirements . We are using mongo database with our application , so would like to continue the same databased with CAS too , but while loading CAS Service registry from the mongo db. , I’m facing an issue. I think the mongo db document with service information is wrong , I couldn’t find proper document information anywhere , hence I was using same as json service registry document . Please help me with the proper document to read service registry from mongo db.

 

here is the mongo db document entry I was using

 

{

    "@class" : "org.apereo.cas.services.RegexRegisteredService",

    "serviceId" : "^http://localhost:6441/cas-management",

    "name" : "CAS App",

    "description": "This is to manage CAS ",

    "id" : 19991,

    "evaluationOrder" : 1

}

 

 

Please help . Early response would be appreciated J

 

Regards,
Vivekanand.  .

Andy Ng

unread,
Aug 20, 2018, 10:52:40 PM8/20/18
to CAS Community
Hi Viveknand,

Last time then I experienmenting with MongoDB as service registrry, I need to:

-  change all the @ to _
- also id need to be _id
- And all the number becomes NumberLong(xxxx)

Something like this should work (tested on 5.3.x):
==================================================================
{
    "_id" : NumberLong(1001),
    "_class" : "org.apereo.cas.support.oauth.services.OAuthRegisteredService",
    "clientId" : "awesomeoauth",
    "clientSecret" : "secr3t",
    "serviceId" : "^https://www.example.com/oauth/.*",
    "name" : "awesomeservice",
    "evaluationOrder" : NumberLong(1001),
    "supportedResponseTypes" : [ 
        "java.util.HashSet", 
        [ 
            "code"
        ]
    ],
    "supportedGrantTypes" : [ 
        "java.util.HashSet", 
        [ 
            "authorization_code", 
            "refresh_token"
        ]
    ]
}

==================================================================
As for why that is no documentation, I am also not sure...

I think I read somewhere on this forum that the MongoDB service registry is intended to be used by the CAS management, and not updated by hand. That might be why no official documentation about how to update the MongoDB service registry manually.

See if other can give you more info on how to properly use MongoDB as service registry. 

Cheers!
- Andy
Reply all
Reply to author
Forward
0 new messages