【发布时间】: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)
它有效,但我想知道这是否只是剩余的,或者预期用途是否不同。
感谢您的支持!
【问题讨论】: