请考虑以下代码摘录:
String openIDProviderURL = "https://www.google.com/accounts/o8/id";
try {
URI loc = getUI().getPage().getLocation();
List discoveries = manager.discover(openIDProviderURL);
DiscoveryInformation discovered = manager.associate(discoveries);
getUI().getSession().setAttribute("openid-disc", discovered);
AuthRequest authReq = manager.authenticate(discovered, "http://"+loc.getHost()+":"+loc.getPort()+loc.getPath());
FetchRequest fetch = FetchRequest.createFetchRequest();
authReq.addExtension(fetch);
System.out.println("DEST URL: "+authReq.getDestinationUrl(true));
getUI().getPage().setLocation(authReq.getDestinationUrl(true));
} catch (DiscoveryException ex) {
Logger.getLogger(NavigatorUI.class.getName()).log(Level.SEVERE, null, ex);
} catch (MessageException ex) {
Logger.getLogger(NavigatorUI.class.getName()).log(Level.SEVERE, null, ex);
} catch (ConsumerException ex) {
Logger.getLogger(NavigatorUI.class.getName()).log(Level.SEVERE, null, ex);
}
}
使用Google进行身份验证可以告诉我如何从我在这里使用的对象中提取实际的openID-identifier-URL?当身份验证成功时,它现在允许我写“INFO: Verification succeeded for: https://www.google.com/accounts/o8/id?blablabla
”,但到目前为止,我还没有找到一种方法来访问程序中的这个URL。有人可以帮帮我吗?
PS:我一直在处理与openID4java有关的旧帖子。但是,他们都处理失败的身份验证和喜欢,这对我来说不是问题。如果以前曾经问过这个问题,我道歉。