【问题标题】:Quarkus OIDC Client Grant ConfigurationQuarkus OIDC 客户端授权配置
【发布时间】:2022-01-05 14:17:44
【问题描述】:

遵循指南https://quarkus.io/guides/security-openid-connect-client#use-oidcclients,尤其是示例

@Path("/clients")
public class OidcClientResource {

    @Inject
    OidcClients clients;

    @GET
    public String getResponse() {
        OidcClientConfig cfg = new OidcClientConfig();
        cfg.setId("myclient");
        cfg.setAuthServerUrl("http://localhost:8081/auth/realms/quarkus/");
        cfg.setClientId("quarkus");
        cfg.getCredentials().setSecret("secret");
        Uni<OidcClient> client = clients.newClient(cfg);
        // use this client to get the token
    }
}

未指定如何设置grant_type。做一些调查,OidcClientConfig 类有一个字段 grant 没有 getter/setter,设置授权的唯一方法是直接访问它并设置 Type 枚举喜欢

cfg.grant.setType(OidcClientConfig.Grant.Type.CODE)

它有效,但我想知道这是否只是剩余的,或者预期用途是否不同。

感谢您的支持!

【问题讨论】:

    标签: openid-connect quarkus


    【解决方案1】:

    此 PR https://github.com/quarkusio/quarkus/pull/22860 将有助于编写 cfg.getGrant().setType(OidcClientConfig.Grant.Type.CODE) 之类的代码,谢谢

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-05-28
      • 2021-07-01
      • 2021-08-20
      • 1970-01-01
      • 1970-01-01
      • 2018-09-25
      • 1970-01-01
      相关资源
      最近更新 更多