简体   繁体   English

在Java Web应用程序中实现双因素身份验证

[英]Implementing two-factor authentication into a Java web app

I have an existing Java web application running through IBM WebSphere (I'm unsure of the version, but could find out if it helps) that I am looking to implement two factor authentication with. 我有一个现有的Java Web应用程序通过IBM WebSphere运行(我不确定该版本,但可以找出它是否有帮助)我希望实现双因素身份验证。

The system has a decent user base, and I wanted to distribute hardware tokens to the admin users of the system to ensure strong authentication. 该系统具有良好的用户群,我想将硬件令牌分发给系统的管理员用户,以确保强大的身份验证。

Minimal impact to the end user is desirable, but I'd like to avoid having the admins need to go through a VPN connection. 对最终用户的影响最小是可取的,但我想避免让管理员需要通过VPN连接。

Does anyone know of any products that provide Java APIs that could be directly integrated into the existing application or other products that will provide a minimal impact? 有没有人知道任何提供Java API的产品可以直接集成到现有应用程序或其他产品中,从而产生最小的影响? I've already spoken with RSA SecurID, but their system wouldn't integrate directly and would require an infrastructure change. 我已经和RSA SecurID谈过了,但他们的系统不能直接集成,需要更改基础设施。 Any other ideas/experience is greatly appreciated. 非常感谢任何其他想法/经验。

For posterity, I've just posted my simple Java two factor authentication utility class to Github . 对于后代,我刚刚将我的简单Java双因素身份验证实用程序类发布到Github With it, you can do something like the following: 有了它,您可以执行以下操作:

TwoFactorAuthUtil twoFactorAuthUtil = new TwoFactorAuthUtil();

// To generate a secret use:
// String base32Secret = generateBase32Secret();
String base32Secret = "NY4A5CPJZ46LXZCP";
// now we can store this in the database associated with the account

// this is the name of the key which can be displayed by the authenticator program
String keyId = "user@j256.com";
System.out.println("Image url = " + twoFactorAuthUtil.qrImageUrl(keyId, base32Secret));
// we can display this image to the user to let them load it into their auth program

// we can use the code here and compare it against user input
String code = twoFactorAuthUtil.generateCurrentNumber(base32Secret);

// this little loop is here to show how the number changes over time
while (true) {
    long diff = TwoFactorAuthUtil.TIME_STEP_SECONDS
        - ((System.currentTimeMillis() / 1000) % TwoFactorAuthUtil.TIME_STEP_SECONDS);
    code = twoFactorAuthUtil.generateCurrentNumber(base32Secret);
    System.out.println("Secret code = " + code + ", change in " + diff + " seconds");
    Thread.sleep(1000);
}

If you want two-factor authentication via a TLS client-certificate, there are a few hardware cryptographic tokens out there. 如果您希望通过TLS客户端证书进行双因素身份验证,那么会有一些硬件加密令牌。 Java can load a PKCS#11 store out of the box, although some configuration may be required. Java可以开箱即用加载PKCS#11商店,但可能需要某些配置。 How much of it is admin configuration vs. application configuration depends on the application (and sometimes on how 'locked' the terminal is wrt to inserting a USB token or having a card reader). 管理员配置与应用程序配置的关系取决于应用程序(有时候,关于终端插入USB令牌或具有读卡器的'锁定'方式)。

There may be alternative solutions, such as One-Time Password tokens (which don't rely on certificates, but on unique passwords instead). 可能存在替代解决方案,例如一次性密码令牌(不依赖于证书,而是依赖于唯一密码)。 This seems less heavy for the users. 这似乎对用户来说不那么重。 I must admit I've never tried it, but this project might be interesting: http://directory.apache.org/triplesec/ (There are also hardware OTP keyrings, usually by the same vendors who do RSA cards/USB tokens). 我必须承认我从来没有尝试过,但这个项目可能很有趣: http//directory.apache.org/triplesec/ (还有硬件OTP密钥环,通常由做RSA卡/ USB令牌的相同供应商提供) 。

We have API packages for Java (and php, ruby, python, and C#): http://www.wikidsystems.com/downloads/network-clients for the WiKID Strong Authentication system. 我们有Java(和php,ruby,python和C#)的API包: http//www.wikidsystems.com/downloads/network-clients用于WiKID强认证系统。 These packages are LGPL, so you can also use them in commercial products. 这些包是LGPL,因此您也可以在商业产品中使用它们。 They work with both our open-source community version and the commercial Enterprise version. 它们与我们的开源社区版本和商业企业版本一起使用。

HTH, HTH,

Nick 缺口

如果您能够使用Spring Security,我们有一个插件,提供双因素身份验证(物理和软件令牌) - www.cloudseal.com

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

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