在Vert.x中获取警告为Nosuchalgorithmexception
我已经使用vert.x Framework中的访问令牌实现了通过携带者身份验证对KeyCloak的UserInfo端点进行保护的后端调用。我可以在没有任何错误的情况下运行此代码。 但是我会收到此警告:
> May 16, 2022 10:33:04 AM
io.vertx.ext.auth.oauth2.impl.OAuth2AuthProviderImpl WARNING: Skipped
> unsupported JWK: java.security.NoSuchAlgorithmException: RSA-OAEP
下面是代码:
> OAuth2ClientOptions clientOptions = new OAuth2ClientOptions()
> .setFlow(OAuth2FlowType.AUTH_CODE)
> .setSite(System.getProperty("oauth2.issuer", "http://localhost:8080/auth/realms/myrealm"))
> .setClientID(System.getProperty("oauth2.client_id", "myclientid"))
> .setClientSecret(System.getProperty("oauth2.client_secret",
> "myclientscret"));
>
> private Handler<RoutingContext> UserInfo(WebClient webClient, String
> userInfoUrl) {
>
> return (RoutingContext ctx) -> {
>
> OAuth2TokenImpl user = (OAuth2TokenImpl) ctx.user();
>
> URI userInfoEndpointUri = URI.create(userInfoUrl);
> webClient
> .get(userInfoEndpointUri.getPort(), userInfoEndpointUri.getHost(), userInfoEndpointUri.getPath())
> .bearerTokenAuthentication(user.opaqueAccessToken())
> .as(BodyCodec.jsonObject())
> .send(ar -> {
> JsonObject body = ar.result().body();
> respondWithOk(ctx, "application/json", body.encodePrettily());
> });
> };
> }
依赖项如下:
> <dependencies>
> <dependency>
> <groupId>io.vertx</groupId>
> <artifactId>vertx-auth-oauth2</artifactId>
> <version>3.9.1</version>
> </dependency>
> <dependency>
> <groupId>io.vertx</groupId>
> <artifactId>vertx-core</artifactId>
> <version>3.9.1</version>
> </dependency>
> <dependency>
> <groupId>io.vertx</groupId>
> <artifactId>vertx-web</artifactId>
> <version>3.9.1</version>
> </dependency>
> <dependency>
> <groupId>io.vertx</groupId>
> <artifactId>vertx-web-client</artifactId>
> <version>3.9.1</version>
> </dependency>
> <dependency>
> <groupId>io.vertx</groupId>
> <artifactId>vertx-auth-jwt</artifactId>
> <version>3.9.1</version>
> </dependency>
> </dependencies>
如何解决此警告?
I have implemented a backend call protected via bearer authentication to the Keycloak's userinfo endpoint using access token in vert.x framework. I am able to run this code without any errors.
But I am getting this warning:
> May 16, 2022 10:33:04 AM
io.vertx.ext.auth.oauth2.impl.OAuth2AuthProviderImpl WARNING: Skipped
> unsupported JWK: java.security.NoSuchAlgorithmException: RSA-OAEP
Below is the code:
> OAuth2ClientOptions clientOptions = new OAuth2ClientOptions()
> .setFlow(OAuth2FlowType.AUTH_CODE)
> .setSite(System.getProperty("oauth2.issuer", "http://localhost:8080/auth/realms/myrealm"))
> .setClientID(System.getProperty("oauth2.client_id", "myclientid"))
> .setClientSecret(System.getProperty("oauth2.client_secret",
> "myclientscret"));
>
> private Handler<RoutingContext> UserInfo(WebClient webClient, String
> userInfoUrl) {
>
> return (RoutingContext ctx) -> {
>
> OAuth2TokenImpl user = (OAuth2TokenImpl) ctx.user();
>
> URI userInfoEndpointUri = URI.create(userInfoUrl);
> webClient
> .get(userInfoEndpointUri.getPort(), userInfoEndpointUri.getHost(), userInfoEndpointUri.getPath())
> .bearerTokenAuthentication(user.opaqueAccessToken())
> .as(BodyCodec.jsonObject())
> .send(ar -> {
> JsonObject body = ar.result().body();
> respondWithOk(ctx, "application/json", body.encodePrettily());
> });
> };
> }
Dependencies are as follows:
> <dependencies>
> <dependency>
> <groupId>io.vertx</groupId>
> <artifactId>vertx-auth-oauth2</artifactId>
> <version>3.9.1</version>
> </dependency>
> <dependency>
> <groupId>io.vertx</groupId>
> <artifactId>vertx-core</artifactId>
> <version>3.9.1</version>
> </dependency>
> <dependency>
> <groupId>io.vertx</groupId>
> <artifactId>vertx-web</artifactId>
> <version>3.9.1</version>
> </dependency>
> <dependency>
> <groupId>io.vertx</groupId>
> <artifactId>vertx-web-client</artifactId>
> <version>3.9.1</version>
> </dependency>
> <dependency>
> <groupId>io.vertx</groupId>
> <artifactId>vertx-auth-jwt</artifactId>
> <version>3.9.1</version>
> </dependency>
> </dependencies>
How to resolve this warning?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
由于现在将
RuntimeException
抛出,您可能需要禁用密钥提供商:realm settings&gt;钥匙&gt;提供商
rsa-enc-enerated
:switch启用
和在一个实例中, ,
RSA-ANC-INERED
已经设置为禁用/停用。当我再次设置它并按下“保存”按钮时,提供商实际上被禁用,并且错误消失了。但是在以后的实例中,它被正确显示为已启用/活动,我必须将其禁用以修复错误。As this now throws a
RuntimeException
you might want to disable the key provider:Realm settings > Keys > Providers
rsa-enc-generated
: switchenabled
andactive
to offIn one instance,
rsa-enc-generated
was already set to disabled/deactivated. When I set it on and off again and hit the save button, the provider is actually disabled and the error disappears. But in a later instance it was correctly shown as enabled/active and I had to disable it to fix the error.您可以忽略此警告,它是仅是故意的警告。
You can ignore this warning, it is just a warning on purpose.