cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lmo...@apache.org
Subject svn commit: r1026891 - in /cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/client: ./ src/main/java/org/apache/cxf/auth/oauth/demo/client/controllers/ src/main/java/org/apache/cxf/auth/oauth/demo/client/model/ src/main/webapp/WE...
Date Sun, 24 Oct 2010 21:14:32 GMT
Author: lmoren
Date: Sun Oct 24 21:14:32 2010
New Revision: 1026891

URL: http://svn.apache.org/viewvc?rev=1026891&view=rev
Log:
- added support for @Secured annotation
 - improved scopes definition
 - simplified configuration

Modified:
    cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/client/pom.xml
    cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/client/src/main/java/org/apache/cxf/auth/oauth/demo/client/controllers/GetProtectedResourceController.java
    cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/client/src/main/java/org/apache/cxf/auth/oauth/demo/client/model/OAuthParams.java
    cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/client/src/main/webapp/WEB-INF/views/accessToken.jsp

Modified: cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/client/pom.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/client/pom.xml?rev=1026891&r1=1026890&r2=1026891&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/client/pom.xml
(original)
+++ cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/client/pom.xml
Sun Oct 24 21:14:32 2010
@@ -68,11 +68,12 @@
         <dependency>
             <groupId>net.oauth.core</groupId>
             <artifactId>oauth-consumer</artifactId>
-            <version>${oauth.version}</version>
+            <version>20100527</version>
         </dependency>
         <dependency>
             <groupId>net.oauth.core</groupId>
             <artifactId>oauth-provider</artifactId>
+            <version>20100527</version>
         </dependency>
 
         <dependency>

Modified: cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/client/src/main/java/org/apache/cxf/auth/oauth/demo/client/controllers/GetProtectedResourceController.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/client/src/main/java/org/apache/cxf/auth/oauth/demo/client/controllers/GetProtectedResourceController.java?rev=1026891&r1=1026890&r2=1026891&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/client/src/main/java/org/apache/cxf/auth/oauth/demo/client/controllers/GetProtectedResourceController.java
(original)
+++ cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/client/src/main/java/org/apache/cxf/auth/oauth/demo/client/controllers/GetProtectedResourceController.java
Sun Oct 24 21:14:32 2010
@@ -34,11 +34,11 @@ import net.oauth.OAuthMessage;
 import net.oauth.OAuthServiceProvider;
 import net.oauth.ParameterStyle;
 import net.oauth.client.OAuthClient;
+import net.oauth.client.OAuthResponseMessage;
 import net.oauth.client.URLConnectionClient;
 
 import org.apache.cxf.auth.oauth.demo.client.model.OAuthParams;
 
-
 import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.ModelAttribute;
 import org.springframework.web.bind.annotation.RequestMapping;
@@ -89,12 +89,25 @@ public class GetProtectedResourceControl
 
         OAuthClient client = new OAuthClient(new URLConnectionClient());
 
-        msg = client.access(msg, ParameterStyle.AUTHORIZATION_HEADER);
+        msg = client.access(msg, ParameterStyle.QUERY_STRING);
 
         StringBuffer bodyBuffer = readBody(msg);
 
         oAuthParams.setResourceResponse(bodyBuffer.toString());
-        oAuthParams.setHeader(msg.getHeader("WWW-Authenticate"));
+        String authHeader = msg.getHeader("WWW-Authenticate");
+        String oauthHeader = msg.getHeader("OAuth");
+        String header = "";
+
+        if (authHeader != null) {
+            header += "WWW-Authenticate:" + authHeader;
+        }
+
+        if (oauthHeader != null) {
+            header += "OAuth:" + oauthHeader;
+        }
+
+        oAuthParams.setHeader(header);
+        oAuthParams.setResponseCode(((OAuthResponseMessage)msg).getHttpResponse().getStatusCode());
 
         return new ModelAndView("accessToken");
     }

Modified: cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/client/src/main/java/org/apache/cxf/auth/oauth/demo/client/model/OAuthParams.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/client/src/main/java/org/apache/cxf/auth/oauth/demo/client/model/OAuthParams.java?rev=1026891&r1=1026890&r2=1026891&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/client/src/main/java/org/apache/cxf/auth/oauth/demo/client/model/OAuthParams.java
(original)
+++ cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/client/src/main/java/org/apache/cxf/auth/oauth/demo/client/model/OAuthParams.java
Sun Oct 24 21:14:32 2010
@@ -29,8 +29,8 @@ public class OAuthParams implements Seri
     private String temporaryCredentialsEndpoint = "http://localhost:8081/auth/oauth/initiate";
     private String resourceOwnerAuthorizationEndpoint = "http://localhost:8081/auth/oauth/authorize";
     private String tokenRequestEndpoint = "http://localhost:8081/auth/oauth/token";
-    private String getResourceURL = "http://localhost:8081/auth/resources/person/john";
-    private String postResourceURL = "http://localhost:8081/auth/resources/person/john";
+    private String getResourceURL = "http://localhost:8081/auth/resources/person/get/john";
+    private String postResourceURL = "http://localhost:8081/auth/resources/person/modify/john";
 
     private String callbackURL = "http://localhost:8080/app/callback";
 
@@ -45,6 +45,7 @@ public class OAuthParams implements Seri
     private String errorMessage;
     private String resourceResponse;
     private String header;
+    private Integer responseCode;
 
     private List<SignatureMethod> methods = new ArrayList<SignatureMethod>();
 
@@ -186,6 +187,14 @@ public class OAuthParams implements Seri
         this.postResourceURL = postResourceURL;
     }
 
+    public Integer getResponseCode() {
+        return responseCode;
+    }
+
+    public void setResponseCode(Integer responseCode) {
+        this.responseCode = responseCode;
+    }
+
     static class SignatureMethod {
         private String methodName;
 

Modified: cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/client/src/main/webapp/WEB-INF/views/accessToken.jsp
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/client/src/main/webapp/WEB-INF/views/accessToken.jsp?rev=1026891&r1=1026890&r2=1026891&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/client/src/main/webapp/WEB-INF/views/accessToken.jsp
(original)
+++ cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/client/src/main/webapp/WEB-INF/views/accessToken.jsp
Sun Oct 24 21:14:32 2010
@@ -86,5 +86,8 @@ under the License.
 <c:if test="${!empty oAuthParams.header}">
     <p><b>Header:</b>${oAuthParams.header}</p>
 </c:if>
+<c:if test="${!empty oAuthParams.responseCode}">
+    <p><b>Response Status:</b>${oAuthParams.responseCode}</p>
+</c:if>
 </body>
 </html>
\ No newline at end of file



Mime
View raw message