正如问题所说:)
这是我使用openid4java发出的请求:
DiscoveryInformation discovered = manager.associate(discoveries);
System.out.println("discovered");
// store the discovery information in the user's session
session.setAttribute("openid-disco", discovered);
// obtain a AuthRequest message to be sent to the OpenID provider
AuthRequest authReq = manager.authenticate(discovered, returnToUrl);
System.out.println("authReq Ok");
// Attribute Exchange example: fetching the 'email' attribute
FetchRequest fetch = FetchRequest.createFetchRequest();
System.out.println("fetch");
fetch.addAttribute("gender", // attribute alias
"http://schema.openid.net/gender", // type URI
true);
fetch.addAttribute("email",
"http://schema.openid.net/contact/email",
true);
fetch.addAttribute("first",
"namePerson/first",
true);
// attach the extension to the authentication request
authReq.addExtension(fetch);
这是我收到的回复。如您所知,名字和性别统计数字为0:
openid.assoc_handle={HMAC-SHA256}{4f156b67}{jEurHw%3D%3D}&
openid.ax.count.email=1
&openid.ax.count.first=0
&openid.ax.count.gender=0
&openid.ax.mode=fetch_response&
openid.ax.type.email=http%3A%2F%2Fschema.openid.net%2Fcontact%2Femail&
openid.ax.type.first=namePerson%2Ffirst&
openid.ax.type.gender=http%3A%2F%2Fschema.openid.net%2Fgender
&openid.ax.value.email.1=saad.alothman%40gmail.com
&openid.claimed_id=http%3A%2F%2Fsaad-alothman.myopenid.com%2F
&openid.identity=http%3A%2F%2Fsaad-alothman.myopenid.com%2F
&openid.mode=id_res
&openid.ns=http%3A%2F%2Fspecs.openid.net%2Fauth%2F2.0
&openid.ns.ax=http%3A%2F%2Fopenid.net%2Fsrv%2Fax%2F1.0
&openid.op_endpoint=http%3A%2F%2Fwww.myopenid.com%2Fserver&
openid.response_nonce=2012-01-17T14%3A32%3A26ZvN5JP4
&openid.return_to=https%3A%2F%2F192.168.133.17%3A10029%2Fwps%2FPA_openIdTest%2Fconsumer_returnurl.jsp
&openid.sig=8%2FES2uury7SxehrYVlH9gef9pB3l1eNQzCLqFJDTXDk%3D&
我尝试myopenid和gmail作为提供商,但它只发送电子邮件。在我的页面重定向时,从提供者页面,它只显示电子邮件,这是我在代码中所要求的一件事,但我添加了名称和性别。
我想获取除姓名,性别和DOB等电子邮件之外的其他信息。
Upadte:我使用了sreg扩展对象,我有三个值(名称,电子邮件,昵称) 但是仍然希望能够获得其他值,如地址......