AWS Cognito用于使用Java中的Vert.x框架进行身份验证

发布于 2025-01-29 14:30:08 字数 168 浏览 2 评论 0原文

我想为我的应用程序实现身份验证机制,并使用Java中的Vert.x框架使用AWS Cognito确保API的API。 AWS Cognito身份验证/授权实现是否有任何演示或示例,因为Internet上对Java中Cognito(AmazonCognitoAuth)实现的Internet上没有太多的演示?请提及代码样本。

I want to implement authentication mechanism for my application and also secure my api's using AWS cognito with vert.x framework in Java. Is there any demo or examples of AWS cognito authentication/Authorization implementation since there isn't much on internet about vert.x implementation of cognito(AmazonCognitoAuth) in java? Please do mention code samples.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

德意的啸 2025-02-05 14:30:08

AWS Cognito是OAuth2 IDP,因此您可以使用Vert.x auth执行任何安全检查。 Vert.x也有一个辅助者,因此可以完成一个新的身份验证提供商:

AmazonCognitoAuth.discover(
  rule.vertx(),
  new OAuth2Options()
    .setSite("https://cognito-idp.eu-central-1.amazonaws.com/{tenant}")
    .setClientId("the-client-id")
    .setClientSecret("the-client-secret")
    .setTenant("user-pool-id"))
  .onSuccess(oauth2 -> {
    // your oauth2 provider is properly configured
    // you can use it in your application
  });

为了构建完整的应用程序,我建议您快速阅读: https://how-to.vertx.io/web-and-oauth2-2-2-2-c/ in解释了Vert.x Oauth2/OIDC的基础知识。

AWS Cognito is a Oauth2 IdP, so you can use vert.x auth to perform any security checks. There is a helper to Cognito in vert.x too, so creating a new authentication provider can be done as:

AmazonCognitoAuth.discover(
  rule.vertx(),
  new OAuth2Options()
    .setSite("https://cognito-idp.eu-central-1.amazonaws.com/{tenant}")
    .setClientId("the-client-id")
    .setClientSecret("the-client-secret")
    .setTenant("user-pool-id"))
  .onSuccess(oauth2 -> {
    // your oauth2 provider is properly configured
    // you can use it in your application
  });

In order to build a full application I'd recommend you to have a quick read at: https://how-to.vertx.io/web-and-oauth2-oidc/ In that how-to the basics of vert.x Oauth2/OIDC are explained.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文