首页 > 解决方案 > 无法使用 keycloak 从 open-id connect 获取配置

问题描述

Keycloak 服务器在端口 8443 上运行,为了授权,我使用了包含所有信息的 JWT 令牌

https 端口给出证书错误:**System.InvalidOperationException:IDX20803:无法从以下位置获取配置:'https://localhost:8443/auth/realms/Smf-Portal/.well-known/openid-configuration'。---> System.IO.IOException:IDX20804:无法从以下位置检索文档:“https://localhost:8443/auth/realms/Smf-Portal/.well-known/openid-configuration”。---> System.Net.Http.HttpRequestException:

无法建立 SSL 连接,请参阅内部异常。** ---> System.Security.Authentication.AuthenticationException:根据验证程序,远程证书无效。

for ex :   

 {
      "exp": 1624451309,
      "iat": 1624451009,
      "jti": "6dea03d9-49d7-4d0e-a81f-91cbc38fe595",
      "iss": "https://default-host:8443/auth/realms/Smf-Portal",
      "sub": "2c2402ad-37c5-4039-b78f-07f9e47cdc35",
      "typ": "Bearer",
      "azp": "timesheet-microservice",
      "session_state": "43e86783-38e1-42de-a4aa-ed229887504b",
      "acr": "1",
      "allowed-origins": [
        "https://localhost:5004"
      ],
      "realm_access": {
        "roles": [
          "app-user"
        ]
      },
      "resource_access": {
        "timesheet-microservice": {
          "roles": [
            "user"
          ]
        }
      },
      "scope": "profile email",
      "email_verified": true,
      "preferred_username": "employee1"
    }

标签: asp.net-corekeycloakopenid-connectasp.net-apicontroller

解决方案


推荐阅读