Home > other >  CAS 6.4 REST Authentication to External Service - Missing type id property '@class'
CAS 6.4 REST Authentication to External Service - Missing type id property '@class'

Time:12-21

I am trying to replace MongoAuthentication (cas-server-support-mongo) with RestAuthentication (cas-server-support-rest-authentication). Here are what I achieved so far:

  • Be able to ask CAS call to my external REST URI to authenticate the user.
  • My REST URI is also be able to return data as CAS required. Here is the log I got. It seems to be OK at this step.
[36m2021-12-18 00:19:18,155 DEBUG [org.apereo.cas.adaptors.rest.RestAuthenticationHandler] 
- <REST authentication response received
[{"_class":"org.apereo.cas.authentication.principal.SimplePrincipal","id":"[email protected]","attributes":{}}]>

Here is the error CAS threw

ERROR [org.apereo.cas.adaptors.rest.RestAuthenticationHandler] 
- <Could not resolve subtype of [simple type, class org.apereo.cas.authentication.principal.Principal]: 
missing type id property '@class'

I am pretty sure that my REST response has id

return {
    '@class': "org.apereo.cas.authentication.principal.SimplePrincipal",
    'id': '[email protected]',
    'attributes': {}
}

I tried all @class or _class. Both of them didn't work at all.

Finally. Cas said

Unable to detect the authentication principal for [email protected]

Could you please kindly advise what I forgot?

THanks, Quang

CodePudding user response:

I don't understand java, i have the same question, i just use the error log and read the document to try, maybe the json can help you

{
"@class": "org.apereo.cas.authentication.principal.SimplePrincipal",
"id": "abc",
"attributes": {
    "@class": "java.util.LinkedHashMap",
    "username": [
        "java.util.List",
        ["jackson"]
    ]
 }
}
  • Related