cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1438095 - in /cxf/branches/2.6.x-fixes: ./ rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/ rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/ rt/rs/securi...
Date Thu, 24 Jan 2013 17:34:42 GMT
Author: sergeyb
Date: Thu Jan 24 17:34:41 2013
New Revision: 1438095

URL: http://svn.apache.org/viewvc?rev=1438095&view=rev
Log:
Merged revisions 1438093 via svnmerge from 
https://svn.apache.org/repos/asf/cxf/branches/2.7.x-fixes

................
  r1438093 | sergeyb | 2013-01-24 17:28:22 +0000 (Thu, 24 Jan 2013) | 13 lines
  
  Merged revisions 1437599,1437990 via svnmerge from 
  https://svn.apache.org/repos/asf/cxf/trunk
  
  ........
    r1437599 | sergeyb | 2013-01-23 17:45:41 +0000 (Wed, 23 Jan 2013) | 1 line
    
    Minor OAuth2 updates
  ........
    r1437990 | sergeyb | 2013-01-24 13:25:33 +0000 (Thu, 24 Jan 2013) | 1 line
    
    Adding the option to add a user name to the authorization page with the custom interface
  ........
................

Added:
    cxf/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/DefaultResourceOwnerNameProvider.java
      - copied unchanged from r1438093, cxf/branches/2.7.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/DefaultResourceOwnerNameProvider.java
    cxf/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/ResourceOwnerNameProvider.java
      - copied unchanged from r1438093, cxf/branches/2.7.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/provider/ResourceOwnerNameProvider.java
Modified:
    cxf/branches/2.6.x-fixes/   (props changed)
    cxf/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/OAuthAuthorizationData.java
    cxf/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/Property.java
    cxf/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java

Propchange: cxf/branches/2.6.x-fixes/
------------------------------------------------------------------------------
  Merged /cxf/branches/2.7.x-fixes:r1438093
  Merged /cxf/trunk:r1437599,1437990

Propchange: cxf/branches/2.6.x-fixes/
------------------------------------------------------------------------------
Binary property 'svnmerge-integrated' - no diff available.

Modified: cxf/branches/2.6.x-fixes/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/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/OAuthAuthorizationData.java?rev=1438095&r1=1438094&r2=1438095&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/OAuthAuthorizationData.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/OAuthAuthorizationData.java
Thu Jan 24 17:34: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/branches/2.6.x-fixes/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/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/Property.java?rev=1438095&r1=1438094&r2=1438095&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/Property.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/common/Property.java
Thu Jan 24 17:34: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/branches/2.6.x-fixes/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/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java?rev=1438095&r1=1438094&r2=1438095&view=diff
==============================================================================
--- cxf/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java
(original)
+++ cxf/branches/2.6.x-fixes/rt/rs/security/oauth-parent/oauth2/src/main/java/org/apache/cxf/rs/security/oauth2/services/RedirectionBasedGrantService.java
Thu Jan 24 17:34:41 2013
@@ -38,9 +38,11 @@ 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;
+import org.apache.cxf.rs.security.oauth2.provider.ResourceOwnerNameProvider;
 import org.apache.cxf.rs.security.oauth2.provider.SessionAuthenticityTokenProvider;
 import org.apache.cxf.rs.security.oauth2.provider.SubjectCreator;
 import org.apache.cxf.rs.security.oauth2.utils.OAuthConstants;
@@ -57,6 +59,7 @@ public abstract class RedirectionBasedGr
     private boolean isClientConfidential;
     private SessionAuthenticityTokenProvider sessionAuthenticityTokenProvider;
     private SubjectCreator subjectCreator;
+    private ResourceOwnerNameProvider resourceOwnerNameProvider;
     
     protected RedirectionBasedGrantService(String supportedResponseType,
                                            String supportedGrantType,
@@ -155,6 +158,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();
         
     }
@@ -179,7 +183,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);
@@ -187,6 +193,12 @@ public abstract class RedirectionBasedGr
         return secData;
     }
     
+    protected void personalizeData(OAuthAuthorizationData data, UserSubject userSubject)
{
+        if (resourceOwnerNameProvider != null) {
+            data.setEndUserName(resourceOwnerNameProvider.getName(userSubject));
+        }
+    }
+    
     /**
      * Completes the authorization process
      */
@@ -334,4 +346,8 @@ public abstract class RedirectionBasedGr
         }
     }
     
+
+    public void setResourceOwnerNameProvider(ResourceOwnerNameProvider resourceOwnerNameProvider)
{
+        this.resourceOwnerNameProvider = resourceOwnerNameProvider;
+    }
 }



Mime
View raw message