[seam-commits] Seam SVN: r10013 - trunk/src/main/org/jboss/seam/security/openid.

seam-commits at lists.jboss.org seam-commits at lists.jboss.org
Thu Feb 5 12:03:48 EST 2009


Author: norman.richards at jboss.com
Date: 2009-02-05 12:03:47 -0500 (Thu, 05 Feb 2009)
New Revision: 10013

Modified:
   trunk/src/main/org/jboss/seam/security/openid/OpenId.java
Log:
JBSEAM-3891

Modified: trunk/src/main/org/jboss/seam/security/openid/OpenId.java
===================================================================
--- trunk/src/main/org/jboss/seam/security/openid/OpenId.java	2009-02-05 16:10:23 UTC (rev 10012)
+++ trunk/src/main/org/jboss/seam/security/openid/OpenId.java	2009-02-05 17:03:47 UTC (rev 10013)
@@ -2,6 +2,8 @@
 
 import java.io.IOException;
 import java.io.Serializable;
+import java.net.MalformedURLException;
+import java.net.URL;
 import java.util.List;
 
 import javax.faces.context.ExternalContext;
@@ -65,12 +67,20 @@
     }
 
     
-    public String returnToUrl() {
+    public String returnToUrl()  {
         FacesContext context = FacesContext.getCurrentInstance();
         HttpServletRequest request = (HttpServletRequest) context.getExternalContext().getRequest();
-        String returnToUrl = "http://" + request.getServerName() + ":" + request.getServerPort() +  
-            context.getApplication().getViewHandler().getActionURL(context, "/openid.xhtml");
-        return returnToUrl;
+
+        try {            
+            URL returnToUrl = new URL("http",
+                    request.getServerName(), 
+                    request.getServerPort(),
+                    context.getApplication().getViewHandler().getActionURL(context, "/openid.xhtml"));
+
+            return returnToUrl.toExternalForm();
+        } catch (MalformedURLException e) {
+            throw new RuntimeException(e);
+        }
     }
     
     public void login() throws IOException {
@@ -173,16 +183,16 @@
             // examine the verification result and extract the verified identifier
             Identifier verified = verification.getVerifiedId();
             if (verified != null) {
-                AuthSuccess authSuccess =
-                    (AuthSuccess) verification.getAuthResponse();
+//                AuthSuccess authSuccess =
+//                    (AuthSuccess) verification.getAuthResponse();
                 
-                if (authSuccess.hasExtension(AxMessage.OPENID_NS_AX)) {
-                    FetchResponse fetchResp = (FetchResponse) authSuccess
-                        .getExtension(AxMessage.OPENID_NS_AX);
-                    
-                    List emails = fetchResp.getAttributeValues("email");
-                    String email = (String) emails.get(0);
-                }
+//                if (authSuccess.hasExtension(AxMessage.OPENID_NS_AX)) {
+//                    FetchResponse fetchResp = (FetchResponse) authSuccess
+//                        .getExtension(AxMessage.OPENID_NS_AX);
+//                    
+//                    List emails = fetchResp.getAttributeValues("email");
+//                    String email = (String) emails.get(0);
+//                }
                 
                 return verified.getIdentifier();
             }




More information about the seam-commits mailing list