System.out.println("actual verify");
VerificationResult verification = manager.verify(receivingURL.toString(), responseParams, null);
// examine the verification result and extract the verified
// identifier
System.out.println("getting verified id");
Identifier id = verification.getVerifiedId();
if (id != null) {
System.out.println("id found");
UserDetails userDetails = new UserDetails();
userDetails.setUniqueId(HttpCookies.getCookieValue(request, uniqueIdCookieName));
userDetails.setOpenId(id.getIdentifier());
AuthSuccess authSuccess = (AuthSuccess) verification.getAuthResponse();
System.out.println("retrieved auth response");
if (authSuccess.hasExtension(AxMessage.OPENID_NS_AX)) {
System.out.println("doing stuff for auth extension");
MessageExtension ext = authSuccess.getExtension(AxMessage.OPENID_NS_AX);
if (ext instanceof FetchResponse) {
FetchResponse fetchResp = (FetchResponse) ext;
System.out.println("adding attributes to user details");
userDetails = addAttributes(fetchResp, userDetails);
}
}
System.out.println("setting id cookie");
HttpCookies.setCookie(request, response, openIdCookieName, id.getIdentifier());
System.out.println("saving identifies for unique id");
callback.saveIdentifierForUniqueId(new File(getServletContext().getRealPath("/")), userDetails);
} else {
System.out.println("id not found");
}