cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1437599 - in /cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2: common/OAuthAuthorizationData.java common/Property.java services/RedirectionBasedGrantService.java
Date Wed, 23 Jan 2013 17:45:41 GMT
Author: sergeyb
Date: Wed Jan 23 17:45:41 2013
New Revision: 1437599

URL: http://svn.apache.org/viewvc?rev=1437599&view=rev
Log:
Minor OAuth2 updates

Modified:
    cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/OAuthAuthorizationData.java
    cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/Property.java
    cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java

Modified: cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/OAuthAuthorizationData.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/OAuthAuthorizationData.java?rev=1437599&r1=1437598&r2=1437599&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/OAuthAuthorizationData.java
(original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/OAuthAuthorizationData.java
Wed Jan 23 17:45:41 2013
@@ -19,6 +19,7 @@
 package org.apache.cxf.rs.security.oauth2.common;
 
 import java.io.Serializable;
+import java.util.LinkedList;
 import java.util.List;
 
 import javax.xml.bind.annotation.XmlRootElement;
@@ -34,6 +35,7 @@ public class OAuthAuthorizationData impl
     private static final long serialVersionUID = -7755998413495017637L;
     
     private String clientId;
+    private String endUserName;
     private String redirectUri;
     private String state;
     private String proposedScope;
@@ -45,8 +47,11 @@ public class OAuthAuthorizationData impl
     private String applicationWebUri;
     private String applicationDescription;
     private String applicationLogoUri;
+    private List<Property> extraApplicationProperties = new LinkedList<Property>();
+    
     private List<? extends Permission> permissions;
     
+    
     public OAuthAuthorizationData() {
     }
 
@@ -232,4 +237,20 @@ public class OAuthAuthorizationData impl
         return replyTo;
     }
 
+    public List<Property> getExtraApplicationProperties() {
+        return extraApplicationProperties;
+    }
+
+    public void setExtraApplicationProperties(List<Property> extraApplicationProperties)
{
+        this.extraApplicationProperties = extraApplicationProperties;
+    }
+
+    public String getEndUserName() {
+        return endUserName;
+    }
+
+    public void setEndUserName(String endUserName) {
+        this.endUserName = endUserName;
+    }
+
 }

Modified: cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/Property.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/Property.java?rev=1437599&r1=1437598&r2=1437599&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/Property.java
(original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/Property.java
Wed Jan 23 17:45:41 2013
@@ -49,4 +49,16 @@ public class Property {
         this.value = value;
     }
     
+    public int hashCode() {
+        return name.hashCode() + 37 * value.hashCode();    
+    }
+    
+    public boolean equalsTo(Object o) {
+        if (o instanceof Property) {
+            Property p = (Property)o;
+            return name.equals(p.name) && value.equals(p.value);
+        } else {
+            return false;
+        }
+    }
 }

Modified: cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java
URL: http://svn.apache.org/viewvc/cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java?rev=1437599&r1=1437598&r2=1437599&view=diff
==============================================================================
--- cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java
(original)
+++ cxf/trunk/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java
Wed Jan 23 17:45:41 2013
@@ -39,6 +39,7 @@ import org.apache.cxf.common.util.String
 import org.apache.cxf.rs.security.oauth2.common.Client;
 import org.apache.cxf.rs.security.oauth2.common.OAuthAuthorizationData;
 import org.apache.cxf.rs.security.oauth2.common.OAuthPermission;
+import org.apache.cxf.rs.security.oauth2.common.Property;
 import org.apache.cxf.rs.security.oauth2.common.ServerAccessToken;
 import org.apache.cxf.rs.security.oauth2.common.UserSubject;
 import org.apache.cxf.rs.security.oauth2.provider.OAuthServiceException;
@@ -156,6 +157,7 @@ public abstract class RedirectionBasedGr
         // Return the authorization challenge data to the end user 
         OAuthAuthorizationData data = 
             createAuthorizationData(client, params, permissions);
+        personalizeData(data, userSubject);
         return Response.ok(data).build();
         
     }
@@ -180,7 +182,9 @@ public abstract class RedirectionBasedGr
         secData.setApplicationWebUri(client.getApplicationWebUri());
         secData.setApplicationDescription(client.getApplicationDescription());
         secData.setApplicationLogoUri(client.getApplicationLogoUri());
-        
+        List<Property> extraProperties = client.getProperties();
+        secData.setExtraApplicationProperties(extraProperties == null ? Collections.<Property>emptyList()
+            : Collections.unmodifiableList(extraProperties));
         String replyTo = getMessageContext().getUriInfo()
             .getAbsolutePathBuilder().path("decision").build().toString();
         secData.setReplyTo(replyTo);
@@ -188,6 +192,11 @@ public abstract class RedirectionBasedGr
         return secData;
     }
     
+    protected void personalizeData(OAuthAuthorizationData data, UserSubject userSubject)
{
+        // at the moment the only option to map a subject login name 
+        // to an actual name is to extend this method, a mapper interface can be introduced
too
+    }
+    
     /**
      * Completes the authorization process
      */



Mime
View raw message