如何在JHipster(版本6.0.1)中配置oauth2?

时间:2019-05-22 17:10:16

标签: jhipster okta

我正在尝试将jhipster v5.8.2更新到v6.0.1 但出现编译错误

 The Issuer "https://dev-672339.oktapreview.com/oauth2/default" provided in the OpenID Configuration did not match the requested issuer "https://login.pomzen.com/oauth2/default"

我先前在application.yml中的配置是:

security:
    oauth2:
        client:
            access-token-uri: https://dev-672339.oktapreview.com/oauth2/default/v1/token
            user-authorization-uri: https://login.pomzen.com/oauth2/default/v1/authorize
            client-id: {myId}
            client-secret: {mySecret}
            scope: openid profile email
            # Token is valid 3 hours
            tokenValidityInSeconds: 10800
        resource:
            user-info-uri: https://dev-672339.oktapreview.com/oauth2/default/v1/userinfo

我在application.yml中的新配置是

security:
    oauth2:
      client:
        provider:
          oidc:
            issuer-uri: https://login.pomzen.com/oauth2/default
        registration:
          oidc:
            client-id: {myId}
            client-secret: {mySecret}

2 个答案:

答案 0 :(得分:1)

您可以为发行人尝试以下内容吗?

https://dev-672339.oktapreview.com/oauth2/default

如果最后使用/.well-known/openid-configuration,您将看到以前必须指定的所有端点。

https://dev-672339.oktapreview.com/oauth2/default/.well-known/openid-configuration

答案 1 :(得分:1)

确保为您的自定义域配置了Okta授权服务器。 转到:https://dev-672339-admin.oktapreview.com/admin/oauth2/as

从列表中选择“默认”授权服务器,然后单击编辑按钮。

您应该有一个颁发者下拉列表,您可以从中选择自定义域。 (请确保该值与您的application.yml

中的值匹配

您对HttpSecurity配置是否有任何自定义设置?