OAuth profile return fields as arrays

32 views
Skip to first unread message

first_step_with_CAS

unread,
Jul 24, 2019, 5:26:24 AM7/24/19
to CAS Community
Why OAuth user profile return fields as arrays?
{  
   "number":[  
      "1234"
   ],
   "fullname": [
       "John Smith"
   ],
   "email":[  
   ],
   "sso_id":[  
      "5d0364ef4fd1c900075487f0"
   ],
   "service":"https://url.com/redirect",
   "id":"em...@example.com",
   "client_id":"secret"
}

I want to response without arrays:

{  
   "number": "1234",
   "fullname": "John Smith",
   "email": "em...@example.com",
   "sso_id": "5d0364ef4fd1c900075487f0",
   "service":"https://url.com/redirect",
   "id":"em...@example.com",
   "client_id":"secret"
}

I tested this on CAS 6.1.0.RC5 and 6.0.4 version.
I used MongoDb, in Mongo all fields have proper types.

cas.properties
cas.authn.mongo.attributes=number,id,email,fullname
cas.authn.oauth.userProfileViewType=FLAT
...

Service configuration
{
  "@class" : "org.apereo.cas.support.oauth.services.OAuthRegisteredService",
  "clientId": "clientid",
  "clientSecret": "clientsecret",
  "serviceId" : ".*example.com/.*",
  "name" : "ClientName",
  "id" : 1000,
  "bypassApprovalPrompt": true,
  "generateRefreshToken": true,
  "supportedGrantTypes": [ "java.util.HashSet", [ "authorization_code" ] ],
  "supportedResponseTypes": [ "java.util.HashSet", [ "code" ] ],
  "attributeReleasePolicy" : {
    "@class" : "org.apereo.cas.services.ReturnAllAttributeReleasePolicy"
  },
  "scopes": [ "java.util.HashSet", ["profile"]]
}


first_step_with_CAS

unread,
Jul 28, 2019, 9:37:16 AM7/28/19
to CAS Community
Bump question
Reply all
Reply to author
Forward
0 new messages