Sent to Authentication OP 1. // Create the customer objects, it issues an authentication request to the authentication server 2. ConsumerManager Manager = new new ConsumerManager (); 3. // association setAssociations method provided the OP storage position, it can be present or a database or memory or xml file, where it is stored in memory 4. manager.setAssociations ( new new InMemoryConsumerAssociationStore ()); 5. the // setNonceVerifier method of setting the recording position response_nonce 6. the manager.setNonceVerifier ( new new InMemoryNonceVerifier (5000 )) ; 7. // download OpenID provider list (usually only one provider) 8. The Discoveries = manager.discover list ( "https://example.com/login/openid/user/" ); 9. The // by associating shared key between access and OpenID provider Discovered the DiscoveryInformation = 10. The manager.associate (Discoveries); 11. The // associating (discovery information) stored, ready for later use 12. The session.setAttribute ( "OpenID-Disc" , Discovered); 13 is . 14. A // to redirect address 15. the returnURL String = "http://example.com/openidresponse.jsp" ; 16. the // redirect the user to their OpenID provider page and tell OpenID provider external site address 17 . authreq the AuthRequest = manager.authenticate (Discovered, the returnURL); 18. a // add additional request parameters (email, fullname) before redirecting 19. a FETCH FetchRequest = FetchRequest.createFetchRequest (); 20. a fetch.addAttribute ( "in Email "," http://schema.openid.net/contact/email ",to true ); 21. A fetch.addAttribute ( "FullName", "http://openid.net/schema/namePerson/friendly", to true ); 22 is . authReq.addExtension (FETCH); 23. A // redirected to the authentication OP Response.sendRedirect 24. A (authReq.getDestinationUrl ( to true )); receiving from the authentication information OpenID provider 1. @ acquisition response parameter list 2. response = ParameterList new new ParameterList (request.getParameterMap ()); 3. the DiscoveryInformation Discovered = ( the DiscoveryInformation) session.getAttribute ( "OpenID-Disc" ); 4. the StringBuffer receivingURL = request.getRequestURL (); 5. The String the queryString = request.getQueryString (); 6. The IF (! The queryString = null && queryString.length ()> 0 ) 7. The receivingURL.append ( "?" ) .Append (request.getQueryString ()); 8. The // The parameter list, the association handle and verification url_query if authenticated 9. The verificationResult the Verification = manager.verify (receivingURL.toString (), Response, Discovered); 10. The Verified Identifier = verification.getVerifiedId (); 11. The iF (! Verified = null ) { 12. The iF (authSuccess. hasExtension (AxMessage.OPENID_NS_AX)) { 13. FetchResponse fetchResp = (FetchResponse) authSuccess.getExtension (AxMessage.OPENID_NS_AX); 14. List emails = fetchResp.getAttributeValues("email"); 15. email = (String) emails.get(0); 16. List fullNames = fetchResp.getAttributeValues("fullname"); 17. fullName = (String) fullNames.get(0); 18. // success.. 19. } 20. } 21. else 22. // OpenID authentication failed