用于谷歌身份验证器的 Java API

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/30202867/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 09:18:55  来源:igfitidea点击:

java API for google Authenticator

javaapigoogle-authenticatorauthenticator

提问by user2437940

I wanna add two factor authentication using Google Authenticator and was wondering if google provides with java api's. I tried searching for it but din't find any. Can anyone point me to the java api if there are any. If not how can i go about using Google Authenticator in my web based java application. I am using Spring framework for my existing application

我想使用 Google Authenticator 添加两因素身份验证,并且想知道 google 是否提供了 java api。我试图寻找它,但没有找到。如果有的话,任何人都可以指出我的java api。如果不是,我该如何在基于 Web 的 Java 应用程序中使用 Google 身份验证器。我正在为我现有的应用程序使用 Spring 框架

回答by Emin

In fact, Google Authenticator has nothing to do with Google services. What you need to look for is TOTP. Research again using TOTP and rfc6238 as keywords and you will find lots of resources.

实际上,Google Authenticator 与 Google 服务无关。您需要寻找的是TOTP。使用TOTP 和rfc6238 作为关键字再次研究,您会发现很多资源

回答by ToVine

Sorry if this is too much of a necro-post, but I found this libraryon GitHub - maybe it can help you (and others looking for the same). :)

对不起,如果这是一个死灵帖,但我在 GitHub 上找到了这个库- 也许它可以帮助你(以及其他寻找相同的人)。:)

Note:this is not an official Google library, but it follows the RFC 6238spec for Time-based One-time Password (TOTP), and the author looked at the C code for Google Authenticatorfor reference.

注意:这不是谷歌官方库,但它遵循基于时间的一次性密码 (TOTP)RFC 6238规范,作者查看了谷歌身份验证器的 C 代码以供参考。

回答by Marufur Rahman

Java library for google authenticator was implemented and can be found here, https://github.com/wstrange/GoogleAuth

谷歌身份验证器的 Java 库已经实现,可以在这里找到, https://github.com/wstrange/GoogleAuth