Re: [cas-user] Multi-level attributes return

21 views
Skip to first unread message

Ray Bon

unread,
Nov 9, 2020, 11:57:20 AM11/9/20
to cas-...@apereo.org
Napolean,

When you say 'returns with one level', do you mean that only one value of the multivalued attrtibute is returned or that the attribute identifier if repeated once for each value?

Enable this logger to see what cas is finding:

        <!-- DEBUG Found principal attributes [...] for [username]
                   Attribute policy [???] allows release of [...] for [username]
                   Final collection of attributes allowed are: [...] -->
        <AsyncLogger name="org.apereo.cas.services.AbstractRegisteredServiceAttributeReleasePolicy" level="debug"/>

Ray

On Sun, 2020-11-08 at 19:22 -0800, Napoleon Ponaparte wrote:
Notice: This message was sent from outside the University of Victoria email system. Please be cautious with links and sensitive information.

Hi
I am using CAS Overlay Template version 6.2.x.
I have configured my Oauth 2.0 service like bellow:

1. My Oauth2.0 service config

{

    "@class" : "org.apereo.cas.support.oauth.services.OAuthRegisteredService",

    "clientId": "xxxx",

    "clientSecret": "xxx",

    "generateRefreshToken" : true,

    "jsonFormat" : true,

    "supported_grants" : ["password", "refresh_token"],

    "serviceId" : "^https://xxxxx/.*",

    "name" : "OAuthJWTService",

    "id" : 3,

    "jwtAccessToken": true,

    "attributeReleasePolicy" : {

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

    "allowedAttributes" : [ "java.util.ArrayList", ["comdepartment","comid","lastname","usercode","userdate","useremail","userparentid","userstatus","usertel","usertype","userid" ] ]

     },

    "properties" : {

      .....

}

2. My CAS authentication attributes config

3. My register user

With this configuration, when I get Oauth 2.0 JWT token, CAS will return me attributes as json with one level.

Now, how c-an I config my service to get return attributed as JSON multi-level?

For example: multi-level in attributes "organization"

{
   "service":"exampleOauthClient",
   "attributes":{
      "data":{
         "comdepartment":"GP2",
         "comid":"VNPTIT2",
         "lastname":" user_anonymous_1 ",
         "usercode":" user_anonymous_1 ",
         "userdate":"09-11-2020",
         "useremail":" user_ano...@gmail.com",
         "userparentid":"VNPTIT2",
         "userstatus":"ACTIVE",
         "usertel":"0907888511",
         "usertype":"USER_COM",
         "userid":"",
         "roles":"",
         "service":"",
         "organization":{
            "organ1":"ACTIVE",
            "organ2":"ACTIVE",
            "organ3":"DISABLE"
         }

      }
   },
   "id":"nguyentra...@vnpt.vn",
   "client_id":"exampleOauthClient"
}

Thank you.



-- 
Ray Bon
Programmer Analyst
Development Services, University Systems

I respectfully acknowledge that my place of work is located within the ancestral, traditional and unceded territory of the Songhees, Esquimalt and WSÁNEĆ Nations.
Reply all
Reply to author
Forward
0 new messages