如何验证Java中的gmail地址 [英] How to validate a gmail address in Java

查看:125
本文介绍了如何验证Java中的gmail地址的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何验证给定的gmail地址是否有效?

我没有要求脚本检查验证,也没有任何正则表达式。我只需要知道某人是否在验证框中输入了有效的Gmail地址。一些代码检查Google的数据库,看它是否是一个有效的Gmail地址。与我们注册新的Gmail地址时相同,并显示一条消息说Gmail邮件地址已存在。如果可以用一些Google API for Java来做到这一点?我希望在GAE中使用它。

解决方案


验证文本框,然后我可以使用什么代码来检查谷歌的数据库,并告诉我这是否是一个有效的ID?


I希望没有办法,因为gmail不应该让他们轻松地将收获电子邮件地址列表垃圾邮件


目录收集攻击或DHA是垃圾邮件发送者用来发现有效/通过使用蛮力在域中的邮件地址。这种攻击通常是通过标准的字典攻击来进行的,其中有效的电子邮件地址是通过暴力猜测有效的电子邮件地址在域中使用不同的普通用户名排列而找到的。这些攻击对于查找公司的电子邮件地址更有效,因为它们可能具有官方电子邮件别名的标准格式(即jdoe@example.domain,johnd@example.domain或johndoe@example.domain)。

任何可让您判断字符串是否为指向真实帐户的Gmail地址的API都可以简化垃圾邮件发送者垃圾邮件用户。







如果不是那么安全的验证方式是什么?


向他们发送一封包含网址的电子邮件,以便他们可以点击确认他们拥有该电子邮件地址。



该链接应该包含一个 nonce ,您可以使用电子邮件addy或者你已经签名的一些信息,所以你知道它来自你。



这种帐户验证非常标准。


How can I verify if a given gmail address is valid or not?

I'm not asking for a script to check validation nor any regular expression. I only need to know if a person put a valid gmail address in a verify box. Some code which checks Google's database to see if it is a valid gmail address. The same as when we register a new gmail address and it shows a message saying the gmail address already exists. If it is possible to do so with some Google API for Java? I would like to use it in GAE.

解决方案

If a person puts a gmail address in a "verify" text-box then what code can I use to check google's database and tell me whether this is a valid ID?

I hope there is no way because gmail should not go out of their way to make it easy to harvest lists of email addresses to spam:

A Directory Harvest Attack or DHA is a technique used by spammers in an attempt to find valid/existent e-mail addresses at a domain by using brute force. The attack is usually carried out by way of a standard dictionary attack, where valid e-mail addresses are found by brute force guessing valid e-mail addresses at a domain using different permutations of common usernames. These attacks are more effective for finding e-mail addresses of companies since they are likely to have a standard format for official e-mail aliases (i.e. jdoe@example.domain, johnd@example.domain, or johndoe@example.domain).

Any API that lets you tell whether a string is a gmail address that points to a live account would simply make it easier for spammers to spam that user.


If not then what are secure way to validate?

Send them an email with a URL that they can click to confirm that they own the email address.

The link should contain a nonce that you store in a database with the email addy or some information you've signed so you know it came from you.

This kinds of account verification is pretty standard.

这篇关于如何验证Java中的gmail地址的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆