【问题标题】:CAS 6.4 REST Authentication to External Service - Missing type id property '@class'CAS 6.4 对外部服务的 REST 身份验证 - 缺少类型 id 属性“@class”
【发布时间】:2021-12-18 01:05:43
【问题描述】:

我正在尝试用 RestAuthentication (cas-server-support-rest-authentication) 替换 MongoAuthentication (cas-server-support-mongo)。以下是我目前取得的成就:

  • 能够要求 CAS 调用我的外部 REST URI 来验证用户身份。
  • 我的 REST URI 也能够根据 CAS 要求返回数据。这是我得到的日志。到这一步好像没问题。
[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":"myemail@gmail.com","attributes":{}}]>

这是 CAS 抛出的错误

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'

我很确定我的 REST 响应有 id

return {
    '@class': "org.apereo.cas.authentication.principal.SimplePrincipal",
    'id': 'myemail@gmail.com',
    'attributes': {}
}

我尝试了所有@class 或_class。他们两个都没有工作。

最后。卡斯说

Unable to detect the authentication principal for myemail@gmail.com

能否请您告知我忘记了什么?

谢谢, 广

【问题讨论】:

    标签: rest cas


    【解决方案1】:

    我不懂java,我也有同样的问题,我只是用错误日志和阅读文档试试,也许json可以帮助你

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

    【讨论】:

    • 哈哈。太谢谢你了兄弟。它适用于我的情况
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2021-06-27
    • 1970-01-01
    • 2023-04-02
    • 2016-11-02
    • 1970-01-01
    • 2013-08-20
    • 2018-07-11
    相关资源
    最近更新 更多