Java中的验证码
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3326778/
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
CAPTCHA in java
提问by Flash
I wanna give a shot at developing a secure login system in Java. How should I implement CAPTCHA using Java?
我想尝试用 Java 开发一个安全的登录系统。我应该如何使用 Java 实现 CAPTCHA?
采纳答案by Hyman Leow
The three CAPTCHA libraries I've used for Java are:
我用于 Java 的三个 CAPTCHA 库是:
JCaptcha- This is the most configurable of the three, and pretty well documented. But we can't seem to get this to look right, no matter what. It also does audio and other unconventional CAPTCHAs
JCaptcha example http://jcaptcha.sourceforge.net/samples/SimpleListImageCaptchaEngineCaptcha_0.jpg
http://jcaptcha.sourceforge.net/SimpleCaptcha- This is reasonably configurable, and pretty well documented. I like the way this looks, but some people have trouble reading it.
SimpleCaptcha example http://simplecaptcha.sourceforge.net/images/Captcha.jpg
http://simplecaptcha.sourceforge.net/icaptcha- This is pretty poorly documented, but shouldn't be too hard to figure out from the examples. In our tests, we found this to be more readable than the other two (can be a good thing or a bad thing, depending on your target audience)
icaptcha example http://icaptcha.googlecode.com/files/2_img_test.jpg
http://code.google.com/p/icaptcha/
JCaptcha- 这是三者中最可配置的,并且有很好的文档记录。但无论如何,我们似乎都无法让它看起来正确。它也做音频和其他非常规
验证码 JCaptcha 示例 http://jcaptcha.sourceforge.net/samples/SimpleListImageCaptchaEngineCaptcha_0.jpg
http://jcaptcha.sourceforge.net/SimpleCaptcha- 这是合理的可配置的,并且有很好的文档记录。我喜欢它的外观,但有些人阅读起来有困难。
SimpleCaptcha 示例 http://simplecaptcha.sourceforge.net/images/Captcha.jpg
http://simplecaptcha.sourceforge.net/icaptcha- 这方面的记录很差,但从示例中应该不难弄清楚。在我们的测试中,我们发现这比其他两个更具可读性(可能是好事也可能是坏事,取决于您的目标受众)
icaptcha 示例 http://icaptcha.googlecode.com/files/2_img_test.jpg
http ://code.google.com/p/icaptcha/
Our apps are Spring MVC based, and it was really easy to integrate these.
我们的应用程序是基于 Spring MVC 的,集成这些非常容易。
We just went with what looked best to us (icaptcha).
我们只是选择了对我们来说最好的(icaptcha)。
回答by zengr
SimpleCaptcha: SimpleCaptcha is a framework used in generating CAPTCHA image/answer pairs for Java (J2EE, Grails, JavaFX, etc.)
SimpleCaptcha:SimpleCaptcha 是用于为 Java(J2EE、Grails、JavaFX 等)生成 CAPTCHA 图像/答案对的框架
But I recommend reCaptcha
但我推荐reCaptcha
Duplicate: Recommendations for java captcha libraries
重复:Java 验证码库的建议
回答by stivlo
I know it's an old question, but I would like to recommend Cage.
我知道这是一个老问题,但我想推荐Cage。
- open source, Apache v2 licensed so it can be used in enterprise/proprietary projects too
- supports maven (available from the central maven repository)
- fast (on the test pc 3-5 msec / image)
- small (a single, small jar, no external dependencies, only Java 1.5 or newer is needed)
- 开源,Apache v2 许可,因此它也可以用于企业/专有项目
- 支持 maven(可从中央 maven 存储库获得)
- 快速(在测试电脑上 3-5 毫秒/图像)
- 小(一个单独的小 jar,没有外部依赖,只需要 Java 1.5 或更新版本)
回答by Altair7852
Another captcha library with a Maven support and working Spring example: https://github.com/axet/kaptcha
另一个具有 Maven 支持和工作 Spring 示例的验证码库:https: //github.com/axet/kaptcha