简体   繁体   English

向我的Web应用程序添加双因素身份验证

[英]Add two factor authentication to my web application

I have a java spring web application and currently it has a normal authentication flow. 我有一个java spring web应用程序,目前它有一个普通的身份验证流程。 I need to add a two factor authentication implementation to it. 我需要为它添加一个双因素身份验证实现。 For that can we use 3rd party provider like google or any other provider. 为此,我们可以使用谷歌或任何其他提供商等第三方提供商。

I need to add a two factor authentication implementation to [my java spring web application]. 我需要在[my java spring web application]中添加一个双因素身份验证实现。

Here's a good package that I wrote which implements 2FA/two-factor authentication in Java code. 是我编写的一个很好的包,它在Java代码中实现2FA /双因素身份验证。

Copying from the READ_ME, to get this to work you: 从READ_ME复制,以使您的工作:

  1. Properly seed the random number generator. 正确播种随机数发生器。
  2. Use generateBase32Secret() to generate a secret key for a user. 使用generateBase32Secret()为用户生成密钥。
  3. Store the secret key in the database associated with the user account. 将密钥存储在与用户帐户关联的数据库中。
  4. Display the QR image URL returned by qrImageUrl(...) to the user. 显示qrImageUrl(...)返回给用户的QR图像URL。
  5. User uses the image to load the secret key into his authenticator application. 用户使用该图像将密钥加载到其身份验证器应用程序中。

Whenever the user logs in: 每当用户登录时:

  1. The user enters the number from the authenticator application into the login form. 用户将验证者应用程序中的号码输入登录表单。
  2. Read the secret associated with the user account from the database. 从数据库中读取与用户帐户关联的密码。
  3. The server compares the user input with the output from generateCurrentNumber(...) . 服务器将用户输入与generateCurrentNumber(...)的输出进行比较。
  4. If they are equal then the user is allowed to log in. 如果它们相等,则允许用户登录。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM