cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From serg...@apache.org
Subject svn commit: r1176408 [1/3] - in /cxf/trunk: distribution/src/main/release/samples/oauth/ distribution/src/main/release/samples/oauth/client/ distribution/src/main/release/samples/oauth/client/src/ distribution/src/main/release/samples/oauth/client/src/...
Date Tue, 27 Sep 2011 14:47:33 GMT
Author: sergeyb
Date: Tue Sep 27 14:47:30 2011
New Revision: 1176408

URL: http://svn.apache.org/viewvc?rev=1176408&view=rev
Log:
[CXF-2759] More refactorings plus adding a demo missed during the original commit

Added:
    cxf/trunk/distribution/src/main/release/samples/oauth/
    cxf/trunk/distribution/src/main/release/samples/oauth/README.TXT   (with props)
    cxf/trunk/distribution/src/main/release/samples/oauth/client/
    cxf/trunk/distribution/src/main/release/samples/oauth/client/pom.xml   (with props)
    cxf/trunk/distribution/src/main/release/samples/oauth/client/src/
    cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/
    cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/
    cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/
    cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/
    cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/
    cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/
    cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/AuthorizeResourceOwnerController.java   (with props)
    cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/CallbackURLController.java   (with props)
    cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/GetProtectedResourceController.java   (with props)
    cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/TemporaryCredentialsController.java   (with props)
    cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/TokenRequestController.java   (with props)
    cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/model/
    cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/model/Common.java   (with props)
    cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/model/OAuthParams.java   (with props)
    cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/
    cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/
    cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/spring-servlet.xml   (with props)
    cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/views/
    cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/views/accessToken.jsp
    cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/views/authorizeResourceOwner.jsp
    cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/views/temporaryCredentials.jsp
    cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/views/tokenRequest.jsp
    cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/web.xml   (with props)
    cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/index.jsp
    cxf/trunk/distribution/src/main/release/samples/oauth/server/
    cxf/trunk/distribution/src/main/release/samples/oauth/server/pom.xml   (with props)
    cxf/trunk/distribution/src/main/release/samples/oauth/server/src/
    cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/
    cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/
    cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/
    cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/
    cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/
    cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/ClientApp.java   (with props)
    cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/CustomAuth.java   (with props)
    cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/SampleResourceProvider.java   (with props)
    cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/controllers/
    cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/controllers/ApplicationController.java   (with props)
    cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/controllers/MemoryOAuthDataProvider.java   (with props)
    cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/controllers/OAuthClientManager.java   (with props)
    cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/controllers/SampleOAuthDataProvider.java   (with props)
    cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/spring/
    cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/spring/AuthenticationFailureHandler.java   (with props)
    cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/spring/AuthenticationSuccessfullHandler.java   (with props)
    cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/spring/SpringOAuthAuthenticationFilter.java   (with props)
    cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/spring/SpringSecurityExceptionMapper.java   (with props)
    cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/webapp/
    cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/webapp/WEB-INF/
    cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/webapp/WEB-INF/oauth-beans.xml   (with props)
    cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/webapp/WEB-INF/security-beans.xml   (with props)
    cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/webapp/WEB-INF/spring-servlet.xml   (with props)
    cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/webapp/WEB-INF/views/
    cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/webapp/WEB-INF/views/authorizedClientsList.jsp
    cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/webapp/WEB-INF/views/clientDetails.jsp
    cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/webapp/WEB-INF/views/displayVerifier.jsp
    cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/webapp/WEB-INF/views/newClientForm.jsp
    cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/webapp/WEB-INF/views/registeredClientsList.jsp
    cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/webapp/WEB-INF/web.xml   (with props)
    cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/webapp/index.jsp
    cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/webapp/oAuthLogin.jsp
Modified:
    cxf/trunk/rt/rs/security/oauth-parent/oauth-test/src/main/java/org/apache/cxf/rs/security/oauth/test/MemoryOAuthDataProvider.java
    cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/data/Client.java
    cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/data/OAuthAuthorizationData.java
    cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/data/RequestTokenRegistration.java
    cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/data/Token.java
    cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/filters/AbstractAuthFilter.java
    cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/filters/OAuthInfo.java
    cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/services/AuthorizationRequestHandler.java
    cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/services/RequestTokenHandler.java
    cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/utils/OAuthConstants.java
    cxf/trunk/rt/rs/security/oauth-parent/oauth/src/main/java/org/apache/cxf/rs/security/oauth/utils/OAuthUtils.java

Added: cxf/trunk/distribution/src/main/release/samples/oauth/README.TXT
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/oauth/README.TXT?rev=1176408&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/oauth/README.TXT (added)
+++ cxf/trunk/distribution/src/main/release/samples/oauth/README.TXT Tue Sep 27 14:47:30 2011
@@ -0,0 +1,63 @@
+OAuth 1.0a demo (client and server)
+========================================
+The OAuth 1.0a demo that shows protocol's flow between OAuth parties. Demo contains two parts:
+
+    client:
+            A web application capable of making OAuth-authenticated requests. It is a usual OAuth client,
+            not dependent on Apache CXF framework, built to test this demo server part and for OAuth
+            educational purposes. Implementation works with any OAuth 1.0a providers, not only inluded
+            in this demo.
+
+
+    server:
+            A web application capable of accepting OAuth-authenticated requests. It is based on Apache
+            CXF OAuth module. It exposes OAuth endpoints and protected resources in the form of JAX-RS
+            services. Server demo shows and explains how CXF OAuth module can be configured to secure
+            JAX-RS services and integrated with existing web applications.
+
+Building and running the demo using maven
+---------------------------------------
+	
+    client:
+            Main directory of client demo application is located in folder: "client", in base folder
+            of this sample.
+            To start demo app use maven command:
+
+            mvn jetty:run
+
+            It will cause in starting Jetty web server and deploying client application at host on port: 8080.
+            Port number is defined in pom.xml.
+
+    server:
+            Main directory of server demo application is located in folder: "server", in base folder
+            of this sample.
+            To start demo app use maven command:
+
+            mvn jetty:run
+
+            It will cause in starting Jetty web server and deploying client application at host on port: 8081.
+            Port number is defined in pom.xml.
+
+			
+	Both client and server modules sepends on Spring 3, so you need to use CXF spring3 profile.
+	You can build both client and server modules using command: 
+			
+			mvn clean install
+			
+	and deploy war from 'target' folder in selected web container.
+
+Performing steps in the OAuth flow 
+-----------------------------
+When you have successfully deployed client and server you can start with OAuth steps:
+1. Go to OAuth server (http://localhost:8081) and login with given username and password
+2. Provide details and register new application at the OAuth server.
+3. You have registered client application at the OAuth server, with associated and displayed
+  client identifier, client shared-secret and callback url. You will need those on the client side.
+4. Go to OAuth client demo (http://localhost:8080) and provide information about the registered application.
+5. Perform usuall OAuth 1.0 flow steps
+
+
+
+Running OAuth 1.0a demo at Google App Engine
+-----------------------------
+//todo add challenges in deploying demo to GAE

Propchange: cxf/trunk/distribution/src/main/release/samples/oauth/README.TXT
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/distribution/src/main/release/samples/oauth/README.TXT
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: cxf/trunk/distribution/src/main/release/samples/oauth/client/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/oauth/client/pom.xml?rev=1176408&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/oauth/client/pom.xml (added)
+++ cxf/trunk/distribution/src/main/release/samples/oauth/client/pom.xml Tue Sep 27 14:47:30 2011
@@ -0,0 +1,101 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+		 	http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.apache.cxf.samples</groupId>
+    <artifactId>oauth_demo-client</artifactId>
+    <name>OAuth 1.0a client</name>
+    <url>http://cxf.apache.org</url>
+    <packaging>war</packaging>
+
+    <parent>
+        <groupId>org.apache.cxf.samples</groupId>
+        <artifactId>cxf-samples</artifactId>
+        <version>2.5.0-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+
+    <build>
+        <finalName>oauth_1.0a_client</finalName>
+        <plugins>
+            <plugin>
+                <groupId>org.mortbay.jetty</groupId>
+                <artifactId>jetty-maven-plugin</artifactId>
+                <version>7.4.5.v20110725</version>
+                <configuration>
+                    <webAppConfig>
+                        <contextPath>/</contextPath>
+                    </webAppConfig>
+                    <connectors>
+                        <connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
+                            <port>8080</port>
+                            <maxIdleTime>60000</maxIdleTime>
+                        </connector>
+                    </connectors>
+                    <scanIntervalSeconds>10</scanIntervalSeconds>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>${jdk.version}</source>
+                    <target>${jdk.version}</target>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-web</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-webmvc</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-core</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-beans</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>net.oauth.core</groupId>
+            <artifactId>oauth-consumer</artifactId>
+            <version>20100527</version>
+        </dependency>
+        <dependency>
+            <groupId>net.oauth.core</groupId>
+            <artifactId>oauth-provider</artifactId>
+            <version>20100527</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.geronimo.specs</groupId>
+            <artifactId>geronimo-servlet_3.0_spec</artifactId>
+            <version>1.0</version>
+        </dependency>
+
+        <dependency>
+            <artifactId>standard</artifactId>
+            <groupId>taglibs</groupId>
+            <version>1.1.2</version>
+            <type>jar</type>
+            <scope>runtime</scope>
+        </dependency>
+    </dependencies>
+
+    <repositories>
+        <repository>
+            <id>oauth</id>
+            <name>OAuth Repository</name>
+            <url>http://oauth.googlecode.com/svn/code/maven/</url>
+        </repository>
+    </repositories>
+</project>

Propchange: cxf/trunk/distribution/src/main/release/samples/oauth/client/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/distribution/src/main/release/samples/oauth/client/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/distribution/src/main/release/samples/oauth/client/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/AuthorizeResourceOwnerController.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/AuthorizeResourceOwnerController.java?rev=1176408&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/AuthorizeResourceOwnerController.java (added)
+++ cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/AuthorizeResourceOwnerController.java Tue Sep 27 14:47:30 2011
@@ -0,0 +1,51 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package demo.oauth.client.controllers;
+
+import javax.servlet.http.HttpServletResponse;
+
+import demo.oauth.client.model.OAuthParams;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+@Controller
+public class AuthorizeResourceOwnerController {
+
+    @RequestMapping("/authorizeResourceOwner")
+    public void handleRequest(@ModelAttribute(value = "oAuthParams") OAuthParams oAuthParams,
+                              HttpServletResponse response) throws Exception {
+
+        String oauthToken = oAuthParams.getOauthToken();
+        String resourceOwnerAuthorizationEndpoint = oAuthParams.getResourceOwnerAuthorizationEndpoint();
+        if (resourceOwnerAuthorizationEndpoint == null || "".equals(resourceOwnerAuthorizationEndpoint)) {
+            oAuthParams.setErrorMessage("Missing resource owner authorization URI");
+        }
+
+        if (oauthToken == null || "".equals(oauthToken)) {
+            oAuthParams.setErrorMessage("Missing oauth token");
+        }
+
+        response
+            .sendRedirect(
+                new StringBuilder().append(resourceOwnerAuthorizationEndpoint).append
+                    ("?oauth_token=").append(oauthToken).toString());
+    }
+}

Propchange: cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/AuthorizeResourceOwnerController.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/AuthorizeResourceOwnerController.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/CallbackURLController.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/CallbackURLController.java?rev=1176408&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/CallbackURLController.java (added)
+++ cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/CallbackURLController.java Tue Sep 27 14:47:30 2011
@@ -0,0 +1,60 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package demo.oauth.client.controllers;
+
+import javax.servlet.http.HttpServletRequest;
+
+import demo.oauth.client.model.Common;
+import demo.oauth.client.model.OAuthParams;
+
+import net.oauth.OAuth;
+import net.oauth.OAuthMessage;
+import net.oauth.OAuthProblemException;
+import net.oauth.server.OAuthServlet;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.servlet.ModelAndView;
+
+
+@Controller
+public class CallbackURLController {
+
+    @RequestMapping("/callback")
+    protected ModelAndView handleRequest(@ModelAttribute("oAuthParams") OAuthParams oAuthParams,
+                                         HttpServletRequest request) throws Exception {
+
+        OAuthMessage message = OAuthServlet.getMessage(request, request.getRequestURL().toString());
+
+        try {
+            message.requireParameters(OAuth.OAUTH_TOKEN, OAuth.OAUTH_VERIFIER);
+            oAuthParams.setOauthToken(message.getToken());
+            oAuthParams.setOauthVerifier(message.getParameter(OAuth.OAUTH_VERIFIER));
+
+            oAuthParams.setClientID(Common.findCookieValue(request, "clientID"));
+            oAuthParams.setClientSecret(Common.findCookieValue(request, "clientSecret"));
+        } catch (OAuthProblemException e) {
+            oAuthParams.setErrorMessage("OAuth problem: " + e.getProblem() + e.getParameters().toString());
+        }
+
+
+        return new ModelAndView("tokenRequest");
+    }
+}

Propchange: cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/CallbackURLController.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/CallbackURLController.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/GetProtectedResourceController.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/GetProtectedResourceController.java?rev=1176408&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/GetProtectedResourceController.java (added)
+++ cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/GetProtectedResourceController.java Tue Sep 27 14:47:30 2011
@@ -0,0 +1,137 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package demo.oauth.client.controllers;
+
+import java.io.BufferedReader;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+import javax.servlet.http.HttpServletRequest;
+
+import demo.oauth.client.model.OAuthParams;
+
+import net.oauth.OAuth;
+import net.oauth.OAuthAccessor;
+import net.oauth.OAuthConsumer;
+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.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.servlet.ModelAndView;
+
+
+@Controller
+public class GetProtectedResourceController {
+
+    @RequestMapping("/getProtectedResource")
+    protected ModelAndView handleRequest(@ModelAttribute("oAuthParams") OAuthParams oAuthParams,
+                                         HttpServletRequest request)
+        throws Exception {
+
+        OAuthServiceProvider provider = new OAuthServiceProvider(
+            oAuthParams.getTemporaryCredentialsEndpoint(),
+            oAuthParams.getResourceOwnerAuthorizationEndpoint(), null);
+
+        OAuthConsumer consumer = new OAuthConsumer(null, oAuthParams.getClientID(),
+            oAuthParams.getClientSecret(),
+            provider);
+        OAuthAccessor accessor = new OAuthAccessor(consumer);
+        accessor.requestToken = oAuthParams.getOauthToken();
+        accessor.tokenSecret = oAuthParams.getOauthTokenSecret(); 
+
+        Map<String, String> parameters = new HashMap<String, String>();
+        parameters.put(OAuth.OAUTH_SIGNATURE_METHOD, oAuthParams.getSignatureMethod());
+        parameters.put(OAuth.OAUTH_NONCE, UUID.randomUUID().toString());
+        parameters.put(OAuth.OAUTH_TIMESTAMP, String.valueOf(System.currentTimeMillis() / 1000));
+        parameters.put(OAuth.OAUTH_TOKEN, oAuthParams.getOauthToken());
+        parameters.put(OAuth.OAUTH_CONSUMER_KEY, oAuthParams.getClientID());
+
+        OAuthMessage msg = null;
+        String method = request.getParameter("op");
+
+
+        if ("GET".equals(method)) {
+            msg = accessor
+                .newRequestMessage(OAuthMessage.GET, oAuthParams.getGetResourceURL(), parameters.entrySet());
+        } else {
+            msg = accessor
+                .newRequestMessage(OAuthMessage.POST, oAuthParams.getPostResourceURL(),
+                    parameters.entrySet());
+        }
+
+
+        OAuthClient client = new OAuthClient(new URLConnectionClient());
+
+        msg = client.access(msg, ParameterStyle.QUERY_STRING);
+
+        StringBuffer bodyBuffer = readBody(msg);
+
+        oAuthParams.setResourceResponse(bodyBuffer.toString());
+        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");
+    }
+
+    private StringBuffer readBody(OAuthMessage msg) throws IOException {
+        StringBuffer body = new StringBuffer();
+        InputStream responseBody = null;
+        BufferedReader br = null;
+        try {
+            responseBody = msg.getBodyAsStream();
+            if (responseBody != null) {
+                br = new BufferedReader(new InputStreamReader(responseBody));
+                String buf;
+                while ((buf = br.readLine()) != null) {
+                    body.append(buf);
+                }
+            }
+        } finally {
+            if (br != null) {
+                br.close();
+            }
+            if (responseBody != null) {
+                responseBody.close();
+            }
+        }
+        return body;
+    }
+
+}

Propchange: cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/GetProtectedResourceController.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/GetProtectedResourceController.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/TemporaryCredentialsController.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/TemporaryCredentialsController.java?rev=1176408&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/TemporaryCredentialsController.java (added)
+++ cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/TemporaryCredentialsController.java Tue Sep 27 14:47:30 2011
@@ -0,0 +1,123 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package demo.oauth.client.controllers;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletResponse;
+
+import demo.oauth.client.model.OAuthParams;
+
+import net.oauth.OAuth;
+import net.oauth.OAuthAccessor;
+import net.oauth.OAuthConsumer;
+import net.oauth.OAuthMessage;
+import net.oauth.OAuthServiceProvider;
+import net.oauth.ParameterStyle;
+import net.oauth.client.OAuthClient;
+import net.oauth.client.URLConnectionClient;
+
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.servlet.ModelAndView;
+
+@Controller
+public class TemporaryCredentialsController {
+
+    @RequestMapping("/handleTemporaryCredentials")
+    public ModelAndView handleRequest(@ModelAttribute(value = "oAuthParams") OAuthParams oAuthParams,
+                                      HttpServletResponse response) {
+
+        OAuthServiceProvider provider;
+        OAuthConsumer consumer;
+        OAuthAccessor accessor;
+
+        OAuthClient client = new OAuthClient(new URLConnectionClient());
+
+        oAuthParams.setErrorMessage(null);
+        String temporaryCredentialsEndpointUrl = oAuthParams.getTemporaryCredentialsEndpoint();
+        if (temporaryCredentialsEndpointUrl == null || "".equals(temporaryCredentialsEndpointUrl)) {
+            oAuthParams.setErrorMessage("Missing temporary credentials endpoint url");
+        }
+        String clientId = oAuthParams.getClientID();
+        if (clientId == null || "".equals(clientId)) {
+            oAuthParams.setErrorMessage("Missing client identifier");
+        }
+        String secret = oAuthParams.getClientSecret();
+        if (secret == null || "".equals(secret)) {
+            oAuthParams.setErrorMessage("Missing client shared-secret");
+        }
+
+        if (oAuthParams.getErrorMessage() == null) {
+            provider = new OAuthServiceProvider(temporaryCredentialsEndpointUrl,
+                oAuthParams.getResourceOwnerAuthorizationEndpoint(), oAuthParams.getTokenRequestEndpoint());
+            consumer = new OAuthConsumer(null, clientId,
+                secret,
+                provider);
+            accessor = new OAuthAccessor(consumer);
+
+            Map<String, String> parameters = new HashMap<String, String>();
+            parameters.put(OAuth.OAUTH_SIGNATURE_METHOD, oAuthParams.getSignatureMethod());
+            parameters.put(OAuth.OAUTH_NONCE, UUID.randomUUID().toString());
+            parameters.put(OAuth.OAUTH_TIMESTAMP, String.valueOf(System.currentTimeMillis() / 1000));
+            parameters.put(OAuth.OAUTH_CALLBACK, oAuthParams.getCallbackURL());
+            parameters.put("realm", "private");
+            parameters.put("x_oauth_scope", "read_info,modify_info");
+            parameters.put("x_oauth_uri", "/resources/person/*");
+
+
+            try {
+                accessor.consumer
+                    .setProperty(OAuthClient.PARAMETER_STYLE, ParameterStyle.AUTHORIZATION_HEADER);
+                client.getRequestToken(accessor, OAuthMessage.POST, parameters.entrySet());
+            } catch (Exception e) {
+                oAuthParams.setErrorMessage(e.toString());
+            }
+
+            oAuthParams.setOauthToken(accessor.requestToken);
+            oAuthParams.setOauthTokenSecret(accessor.tokenSecret);
+            Cookie cId = new Cookie("clientID", oAuthParams.getClientID());
+            Cookie cSec = new Cookie("clientSecret", oAuthParams.getClientSecret());
+            Cookie tokenSec = new Cookie("tokenSec", accessor.tokenSecret); 
+            response.addCookie(cId);
+            response.addCookie(cSec);
+            response.addCookie(tokenSec);
+        }
+
+        ModelAndView modelAndView = new ModelAndView();
+        if (oAuthParams.getErrorMessage() != null) {
+            modelAndView.setViewName("temporaryCredentials");
+        } else {
+            modelAndView.setViewName("authorizeResourceOwner");
+        }
+
+        return modelAndView;
+    }
+
+    @RequestMapping("/temporaryCredentials")
+    public ModelAndView handleInternalRequest(
+        @ModelAttribute(value = "oAuthParams") OAuthParams oAuthParams) {
+        return new ModelAndView("temporaryCredentials");
+    }
+
+}

Propchange: cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/TemporaryCredentialsController.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/TemporaryCredentialsController.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/TokenRequestController.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/TokenRequestController.java?rev=1176408&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/TokenRequestController.java (added)
+++ cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/TokenRequestController.java Tue Sep 27 14:47:30 2011
@@ -0,0 +1,112 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package demo.oauth.client.controllers;
+
+import java.util.HashMap;
+import java.util.Map;
+import java.util.UUID;
+import javax.servlet.http.HttpServletRequest;
+
+import demo.oauth.client.model.Common;
+import demo.oauth.client.model.OAuthParams;
+
+
+import net.oauth.OAuth;
+import net.oauth.OAuthAccessor;
+import net.oauth.OAuthConsumer;
+import net.oauth.OAuthMessage;
+import net.oauth.OAuthServiceProvider;
+import net.oauth.client.OAuthClient;
+import net.oauth.client.URLConnectionClient;
+
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.servlet.ModelAndView;
+
+@Controller
+public class TokenRequestController {
+
+    @RequestMapping("/tokenRequest")
+    protected ModelAndView handleRequest(@ModelAttribute("oAuthParams") OAuthParams oAuthParams,
+                                         HttpServletRequest request)
+        throws Exception {
+
+        String oauthToken = oAuthParams.getOauthToken();
+
+        String tokenRequestEndpoint = oAuthParams.getTokenRequestEndpoint();
+        String clientID = oAuthParams.getClientID();
+
+        if (tokenRequestEndpoint == null || "".equals(tokenRequestEndpoint)) {
+            oAuthParams.setErrorMessage("Missing token request URI");
+        }
+
+        if (clientID == null || "".equals(clientID)) {
+            oAuthParams.setErrorMessage("Missing consumer key");
+        }
+
+        if (oauthToken == null || "".equals(oauthToken)) {
+            oAuthParams.setErrorMessage("Missing oauth token");
+        }
+
+        String verifier = oAuthParams.getOauthVerifier();
+        if (verifier == null || "".equals(verifier)) {
+            oAuthParams.setErrorMessage("Missing oauth verifier");
+        }
+
+        if (oAuthParams.getErrorMessage() == null) {
+            OAuthClient client = new OAuthClient(new URLConnectionClient());
+            OAuthServiceProvider provider = new OAuthServiceProvider(
+                oAuthParams.getTemporaryCredentialsEndpoint(),
+                oAuthParams.getResourceOwnerAuthorizationEndpoint(), tokenRequestEndpoint);
+
+            OAuthConsumer consumer = new OAuthConsumer(null, clientID,
+                oAuthParams.getClientSecret(),
+                provider);
+            OAuthAccessor accessor = new OAuthAccessor(consumer);
+            accessor.requestToken = oauthToken;
+            accessor.tokenSecret = Common.findCookieValue(request, "tokenSec");
+            
+            Map<String, String> parameters = new HashMap<String, String>();
+            parameters.put(OAuth.OAUTH_SIGNATURE_METHOD, oAuthParams.getSignatureMethod());
+            parameters.put(OAuth.OAUTH_NONCE, UUID.randomUUID().toString());
+            parameters.put(OAuth.OAUTH_TIMESTAMP, String.valueOf(System.currentTimeMillis() / 1000));
+            parameters.put(OAuth.OAUTH_TOKEN, oauthToken);
+            parameters.put(OAuth.OAUTH_VERIFIER, oAuthParams.getOauthVerifier());
+
+
+            try {
+                client.getAccessToken(accessor, OAuthMessage.GET, parameters.entrySet());
+                oAuthParams.setOauthToken(accessor.accessToken);
+            } catch (Exception e) {
+                oAuthParams.setErrorMessage(e.toString());
+                oAuthParams.setOauthToken(oauthToken);
+                return new ModelAndView("tokenRequest");
+            }
+            oAuthParams.setOauthTokenSecret(accessor.tokenSecret);
+        }
+
+        oAuthParams.setClientID(Common.findCookieValue(request, "clientID"));
+        oAuthParams.setClientSecret(Common.findCookieValue(request, "clientSecret"));
+
+        return new ModelAndView("accessToken");
+    }
+
+}

Propchange: cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/TokenRequestController.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/controllers/TokenRequestController.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/model/Common.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/model/Common.java?rev=1176408&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/model/Common.java (added)
+++ cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/model/Common.java Tue Sep 27 14:47:30 2011
@@ -0,0 +1,38 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package demo.oauth.client.model;
+
+import javax.servlet.http.Cookie;
+import javax.servlet.http.HttpServletRequest;
+
+public final class Common {
+    private Common() {
+    }
+
+    public static String findCookieValue(HttpServletRequest request, String key) {
+        Cookie[] cookies = request.getCookies();
+
+        for (Cookie cooky : cookies) {
+            if (cooky.getName().equals(key)) {
+                return cooky.getValue();
+            }
+        }
+        return "";
+    }
+}

Propchange: cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/model/Common.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/model/Common.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/model/OAuthParams.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/model/OAuthParams.java?rev=1176408&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/model/OAuthParams.java (added)
+++ cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/model/OAuthParams.java Tue Sep 27 14:47:30 2011
@@ -0,0 +1,210 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package demo.oauth.client.model;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+public class OAuthParams implements Serializable {
+    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/get/john";
+    private String postResourceURL = "http://localhost:8081/auth/resources/person/modify/john";
+
+    private String callbackURL = "http://localhost:8080/app/callback";
+
+    private String clientID = "12345678";
+    private String clientSecret = "secret";
+    private String signatureMethod;
+
+    private String oauthToken;
+    private String oauthTokenSecret;
+    private String oauthVerifier;
+
+    private String errorMessage;
+    private String resourceResponse;
+    private String header;
+    private Integer responseCode;
+
+    private List<SignatureMethod> methods = new ArrayList<SignatureMethod>();
+
+    public OAuthParams() {
+        methods.add(new SignatureMethod("HMAC-SHA1"));
+    }
+
+    public OAuthParams(String clientSecret, String clientID) {
+        super();
+        this.clientSecret = clientSecret;
+        this.clientID = clientID;
+    }
+
+    public String getClientSecret() {
+        return clientSecret;
+    }
+
+    public void setClientSecret(String clientSecret) {
+        this.clientSecret = clientSecret;
+    }
+
+    public String getClientID() {
+        return clientID;
+    }
+
+    public void setClientID(String clientID) {
+        this.clientID = clientID;
+    }
+
+    public String getSignatureMethod() {
+        return signatureMethod;
+    }
+
+    public void setSignatureMethod(String signatureMethod) {
+        this.signatureMethod = signatureMethod;
+    }
+
+    public String getTemporaryCredentialsEndpoint() {
+        return temporaryCredentialsEndpoint;
+    }
+
+    public void setTemporaryCredentialsEndpoint(String temporaryCredentialsEndpoint) {
+        this.temporaryCredentialsEndpoint = temporaryCredentialsEndpoint;
+    }
+
+    public String getOauthToken() {
+        return oauthToken;
+    }
+
+    public void setOauthToken(String oauthToken) {
+        this.oauthToken = oauthToken;
+    }
+
+    public String getOauthTokenSecret() {
+        return oauthTokenSecret;
+    }
+
+    public void setOauthTokenSecret(String oauthTokenSecret) {
+        this.oauthTokenSecret = oauthTokenSecret;
+    }
+
+    public String getResourceOwnerAuthorizationEndpoint() {
+        return resourceOwnerAuthorizationEndpoint;
+    }
+
+    public void setResourceOwnerAuthorizationEndpoint(String resourceOwnerAuthorizationEndpoint) {
+        this.resourceOwnerAuthorizationEndpoint = resourceOwnerAuthorizationEndpoint;
+    }
+
+    public String getTokenRequestEndpoint() {
+        return tokenRequestEndpoint;
+    }
+
+    public void setTokenRequestEndpoint(String tokenRequestEndpoint) {
+        this.tokenRequestEndpoint = tokenRequestEndpoint;
+    }
+
+    public String getOauthVerifier() {
+        return oauthVerifier;
+    }
+
+    public void setOauthVerifier(String oauthVerifier) {
+        this.oauthVerifier = oauthVerifier;
+    }
+
+    public String getErrorMessage() {
+        return errorMessage;
+    }
+
+    public void setErrorMessage(String errorMessage) {
+        this.errorMessage = errorMessage;
+    }
+
+    public String getGetResourceURL() {
+        return getResourceURL;
+    }
+
+    public void setGetResourceURL(String getResourceURL) {
+        this.getResourceURL = getResourceURL;
+    }
+
+    public String getCallbackURL() {
+        return callbackURL;
+    }
+
+    public void setCallbackURL(String callbackURL) {
+        this.callbackURL = callbackURL;
+    }
+
+    public String getResourceResponse() {
+        return resourceResponse;
+    }
+
+    public void setResourceResponse(String resourceResponse) {
+        this.resourceResponse = resourceResponse;
+    }
+
+    public String getHeader() {
+        return header;
+    }
+
+    public void setHeader(String header) {
+        this.header = header;
+    }
+
+    public List getMethods() {
+        return methods;
+    }
+
+    public void setMethods(List<SignatureMethod> methods) {
+        this.methods = methods;
+    }
+
+    public String getPostResourceURL() {
+        return postResourceURL;
+    }
+
+    public void setPostResourceURL(String postResourceURL) {
+        this.postResourceURL = postResourceURL;
+    }
+
+    public Integer getResponseCode() {
+        return responseCode;
+    }
+
+    public void setResponseCode(Integer responseCode) {
+        this.responseCode = responseCode;
+    }
+
+    static class SignatureMethod {
+        private String methodName;
+
+        SignatureMethod(String methodName) {
+            this.methodName = methodName;
+        }
+
+        public String getMethodName() {
+            return methodName;
+        }
+
+        public void setMethodName(String methodName) {
+            this.methodName = methodName;
+        }
+    }
+}

Propchange: cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/model/OAuthParams.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/java/demo/oauth/client/model/OAuthParams.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/spring-servlet.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/spring-servlet.xml?rev=1176408&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/spring-servlet.xml (added)
+++ cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/spring-servlet.xml Tue Sep 27 14:47:30 2011
@@ -0,0 +1,36 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xmlns:mvc="http://www.springframework.org/schema/mvc"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
+       http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/context
+       http://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
+
+    <mvc:annotation-driven/>
+    <context:annotation-config/>
+    <context:component-scan base-package="demo.oauth.client.controllers"/>
+
+    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
+        <property name="prefix" value="/WEB-INF/views/"/>
+        <property name="suffix" value=".jsp"/>
+    </bean>
+
+</beans>

Propchange: cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/spring-servlet.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/spring-servlet.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/spring-servlet.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/views/accessToken.jsp
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/views/accessToken.jsp?rev=1176408&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/views/accessToken.jsp (added)
+++ cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/views/accessToken.jsp Tue Sep 27 14:47:30 2011
@@ -0,0 +1,93 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<%--@elvariable id="oAuthParams" type="org.apache.cxf.auth.oauth.demo.client.model.OAuthParams"--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ page isELIgnored="false" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
+
+<html>
+<head>
+    <title>OAuth Client</title>
+</head>
+<body>
+<table align="center">
+    <tr>
+        <td><h2>Sample OAuth 1.0a client implementation</h2></td>
+    </tr>
+</table>
+<h3>Step 4. Get Protected Resource</h3>
+
+<form:form commandName="oAuthParams" action="/app/getProtectedResource">
+    <table>
+        <tr>
+            <td>OAuth Token:</td>
+            <td><form:input size="70" path="oauthToken"/></td>
+        </tr>
+        <tr>
+            <td>OAuth Secret:</td>
+            <td><form:input size="70" path="oauthTokenSecret"/></td>
+        </tr>
+        <tr>
+            <td>Client Identifier:</td>
+            <td><form:input size="70" path="clientID"/></td>
+        </tr>
+        <tr>
+            <td>Client Shared-Secret:</td>
+            <td><form:input size="70" path="clientSecret"/></td>
+        </tr>
+        <tr>
+            <td>GET Protected Resource, need scope: 'read_info'</td>
+            <td><form:input size="70" path="getResourceURL"/></td>
+        </tr>
+        <tr>
+            <td>POST Protected Resource, need scope: 'modify_info'</td>
+            <td><form:input size="70" path="postResourceURL"/></td>
+        </tr>
+        <tr>
+            <td>Signature Method:</td>
+            <td><form:select path="signatureMethod">
+                <form:options items="${oAuthParams.methods}" itemValue="methodName"
+                              itemLabel="methodName"/>
+            </form:select></td>
+        </tr>
+        <tr>
+            <td colspan="2">
+                <input type="submit" name="op" value="GET"/>
+            </td>
+        </tr>
+        <tr>
+            <td colspan="2">
+                <input type="submit" name="op" value="POST"/>
+            </td>
+        </tr>
+    </table>
+</form:form>
+
+<c:if test="${!empty oAuthParams.resourceResponse}">
+    <p><b>Response:</b> ${oAuthParams.resourceResponse}</p>
+</c:if>
+<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

Added: cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/views/authorizeResourceOwner.jsp
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/views/authorizeResourceOwner.jsp?rev=1176408&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/views/authorizeResourceOwner.jsp (added)
+++ cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/views/authorizeResourceOwner.jsp Tue Sep 27 14:47:30 2011
@@ -0,0 +1,73 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<%--@elvariable id="text" type="java.lang.String"--%>
+<%--@elvariable id="oAuthParams" type="org.apache.cxf.auth.oauth.demo.client.model.OAuthParams"--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ page isELIgnored="false" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
+
+<html>
+<head>
+    <title>OAuth 1.0a client</title>
+</head>
+<body>
+<table align="center">
+    <tr>
+        <td><h2>Sample OAuth 1.0a client implementation</h2></td>
+    </tr>
+</table>
+<h3>Step 2. Authorize Resource Owner</h3>
+
+<form:form commandName="oAuthParams" action="/app/authorizeResourceOwner">
+    <c:if test="${!empty oAuthParams.errorMessage}">
+        <font color="red"><p>Error: ${oAuthParams.errorMessage}</p></font>
+    </c:if>
+    <table>
+        <tr>
+            <td>Response:</td>
+        </tr>
+        <tr>
+            <td>OAuth Token:</td>
+            <td><form:input size="70" path="oauthToken"/></td>
+        </tr>
+        <tr>
+            <td>OAuth Token Secret:</td>
+            <td><form:input size="70" path="oauthTokenSecret"/></td>
+        </tr>
+        <tr>
+            <td>&nbsp;</td>
+            <td>&nbsp;</td>
+        </tr>
+        <tr>
+            <td>Required OAuth parameters:</td>
+        </tr>
+        <tr>
+            <td>Resource Owner Authorization Endpoint URI:</td>
+            <td><form:input size="70" path="resourceOwnerAuthorizationEndpoint"/></td>
+        </tr>
+        <tr>
+            <td colspan="2">
+                <input type="submit" value="Authorize Resource Owner"/>
+            </td>
+        </tr>
+    </table>
+</form:form>
+</body>
+</html>
\ No newline at end of file

Added: cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/views/temporaryCredentials.jsp
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/views/temporaryCredentials.jsp?rev=1176408&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/views/temporaryCredentials.jsp (added)
+++ cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/views/temporaryCredentials.jsp Tue Sep 27 14:47:30 2011
@@ -0,0 +1,83 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<%--@elvariable id="text" type="java.lang.String"--%>
+<%--@elvariable id="oAuthParams" type="org.apache.cxf.auth.oauth.demo.client.model.OAuthParams"--%>
+<%--@elvariable id="methods" type="java.util.List"--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ page isELIgnored="false" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
+
+<html>
+<head>
+    <title>OAuth 1.0a client</title>
+</head>
+<body>
+<table align="center">
+    <tr>
+        <td><h2>Sample OAuth 1.0a client implementation</h2></td>
+    </tr>
+</table>
+
+<p>
+
+<h3>Step 1. Get OAuth temporary credentials</h3></p>
+
+<form:form commandName="oAuthParams" action="/app/handleTemporaryCredentials">
+    <c:if test="${!empty oAuthParams.errorMessage}">
+        <font color="red"><p>Error: ${oAuthParams.errorMessage}</p></font>
+    </c:if>
+    <table>
+        <tr>
+            <td>Required OAuth parameters:</td>
+        </tr>
+        <tr>
+            <td>Temporary Credentials Endoint URI:</td>
+            <td><form:input size="70" path="temporaryCredentialsEndpoint"/></td>
+        </tr>
+        <tr>
+            <td>Client Identifier:</td>
+            <td><form:input size="70" path="clientID"/></td>
+        </tr>
+        <tr>
+            <td>Client Shared-Secret:</td>
+            <td><form:input size="70" path="clientSecret"/></td>
+        </tr>
+        <tr>
+            <td>Callback URL:</td>
+            <td><form:input size="70" path="callbackURL"/></td>
+        </tr>
+        <tr>
+            <td>Signature Method:</td>
+            <td>
+                <form:select path="signatureMethod">
+                    <form:options items="${oAuthParams.methods}" itemValue="methodName"
+                                  itemLabel="methodName"/>
+                </form:select>
+            </td>
+        </tr>
+        <tr>
+            <td colspan="2">
+                <input type="submit" value="Get Temporary Credentials"/>
+            </td>
+        </tr>
+    </table>
+</form:form>
+</body>
+</html>
\ No newline at end of file

Added: cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/views/tokenRequest.jsp
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/views/tokenRequest.jsp?rev=1176408&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/views/tokenRequest.jsp (added)
+++ cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/views/tokenRequest.jsp Tue Sep 27 14:47:30 2011
@@ -0,0 +1,92 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<%--@elvariable id="text" type="java.lang.String"--%>
+<%--@elvariable id="oAuthParams" type="org.apache.cxf.auth.oauth.demo.client.model.OAuthParams"--%>
+<%@ page contentType="text/html;charset=UTF-8" language="java" %>
+<%@ page isELIgnored="false" %>
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
+
+<html>
+<head>
+    <title>OAuth 1.0a Client</title>
+</head>
+<body>
+<table align="center">
+    <tr>
+        <td><h2>Sample OAuth 1.0a client implementation</h2></td>
+    </tr>
+</table>
+<h3>Step 3. Request Access Token</h3>
+
+<form:form commandName="oAuthParams" action="/app/tokenRequest">
+    <c:if test="${!empty oAuthParams.errorMessage}">
+        <font color="red"><p>Error: ${oAuthParams.errorMessage}</p></font>
+    </c:if>
+    <table>
+        <tr>
+            <td>Response:</td>
+            <td></td>
+        </tr>
+        <tr>
+            <td>OAuth Token:</td>
+            <td><form:input size="70" path="oauthToken"/></td>
+        </tr>
+        <tr>
+            <td>OAuth Verifier:</td>
+            <td><form:input size="70" path="oauthVerifier"/></td>
+        </tr>
+        <tr>
+            <td>&nbsp;</td>
+            <td>&nbsp;</td>
+        </tr>
+        <tr>
+            <td>Required OAuth parameters:</td>
+        </tr>
+        <tr>
+            <td>Token Request URI:</td>
+            <td><form:input size="70" path="tokenRequestEndpoint"/></td>
+        </tr>
+
+        <tr>
+            <td>Client Identifier:</td>
+            <td><form:input size="70" path="clientID"/></td>
+        </tr>
+        <tr>
+            <td>Client Shared-Secret:</td>
+            <td><form:input size="70" path="clientSecret"/></td>
+        </tr>
+        <tr>
+            <td>Signature Method:</td>
+            <td>
+                <form:select path="signatureMethod">
+                    <form:options items="${oAuthParams.methods}" itemValue="methodName"
+                                  itemLabel="methodName"/>
+                </form:select>
+            </td>
+        </tr>
+        <tr>
+            <td colspan="2">
+                <input type="submit" value="Request Access Token"/>
+            </td>
+        </tr>
+    </table>
+</form:form>
+</body>
+</html>
\ No newline at end of file

Added: cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/web.xml?rev=1176408&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/web.xml (added)
+++ cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/web.xml Tue Sep 27 14:47:30 2011
@@ -0,0 +1,49 @@
+<!--
+  Licensed to the Apache Software Foundation (ASF) under one
+  or more contributor license agreements. See the NOTICE file
+  distributed with this work for additional information
+  regarding copyright ownership. The ASF licenses this file
+  to you under the Apache License, Version 2.0 (the
+  "License"); you may not use this file except in compliance
+  with the License. You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+  Unless required by applicable law or agreed to in writing,
+  software distributed under the License is distributed on an
+  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  KIND, either express or implied. See the License for the
+  specific language governing permissions and limitations
+  under the License.
+-->
+<web-app xmlns="http://java.sun.com/xml/ns/javaee"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
+         http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+         metadata-complete="true" version="2.5">
+
+    <context-param>
+        <param-name>contextConfigLocation</param-name>
+        <param-value>/WEB-INF/spring-servlet.xml</param-value>
+    </context-param>
+
+    <listener>
+        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+    </listener>
+
+    <servlet>
+        <servlet-name>spring</servlet-name>
+        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+
+    <servlet-mapping>
+        <servlet-name>spring</servlet-name>
+        <url-pattern>/app/*</url-pattern>
+    </servlet-mapping>
+
+
+    <welcome-file-list>
+        <welcome-file>index.jsp</welcome-file>
+    </welcome-file-list>
+</web-app>

Propchange: cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/WEB-INF/web.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/index.jsp
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/index.jsp?rev=1176408&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/index.jsp (added)
+++ cxf/trunk/distribution/src/main/release/samples/oauth/client/src/main/webapp/index.jsp Tue Sep 27 14:47:30 2011
@@ -0,0 +1,20 @@
+<!--
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements. See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership. The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License. You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied. See the License for the
+specific language governing permissions and limitations
+under the License.
+-->
+<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
+<%response.sendRedirect("/app/temporaryCredentials"); %>

Added: cxf/trunk/distribution/src/main/release/samples/oauth/server/pom.xml
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/oauth/server/pom.xml?rev=1176408&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/oauth/server/pom.xml (added)
+++ cxf/trunk/distribution/src/main/release/samples/oauth/server/pom.xml Tue Sep 27 14:47:30 2011
@@ -0,0 +1,138 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
+		 	http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <modelVersion>4.0.0</modelVersion>
+    <groupId>org.apache.cxf.samples</groupId>
+    <artifactId>oauth_demo-server</artifactId>
+    <name>OAuth 1.0a server</name>
+    <packaging>war</packaging>
+
+    <parent>
+        <groupId>org.apache.cxf.samples</groupId>
+        <artifactId>cxf-samples</artifactId>
+        <version>2.5.0-SNAPSHOT</version>
+        <relativePath>../../pom.xml</relativePath>
+    </parent>
+
+    <build>
+        <finalName>oauth_1.0a_server</finalName>
+        <plugins>
+            <plugin>
+                <groupId>org.mortbay.jetty</groupId>
+                <artifactId>maven-jetty-plugin</artifactId>
+                <version>6.1.24</version>
+                <configuration>
+                    <webAppConfig>
+                        <contextPath>/</contextPath>
+                    </webAppConfig>
+                    <connectors>
+                        <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
+                            <port>8081</port>
+                            <maxIdleTime>60000</maxIdleTime>
+                        </connector>
+                    </connectors>
+                    <scanIntervalSeconds>10</scanIntervalSeconds>
+                </configuration>
+            </plugin>
+            <plugin>
+                <groupId>org.apache.maven.plugins</groupId>
+                <artifactId>maven-compiler-plugin</artifactId>
+                <configuration>
+                    <source>${jdk.version}</source>
+                    <target>${jdk.version}</target>
+                </configuration>
+            </plugin>
+        </plugins>
+    </build>
+
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-rs-security-oauth</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-transports-http-jetty</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-frontend-jaxrs</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-web</artifactId>
+            <version>3.0.3.RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-webmvc</artifactId>
+            <version>3.0.3.RELEASE</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-core</artifactId>
+            <version>3.0.3.RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-beans</artifactId>
+            <version>3.0.3.RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework</groupId>
+            <artifactId>spring-context</artifactId>
+            <version>3.0.3.RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.security</groupId>
+            <artifactId>spring-security-core</artifactId>
+            <version>3.0.3.RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.security</groupId>
+            <artifactId>spring-security-web</artifactId>
+            <version>3.0.3.RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.security</groupId>
+            <artifactId>spring-security-config</artifactId>
+            <version>3.0.3.RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>org.springframework.security</groupId>
+            <artifactId>spring-security-acl</artifactId>
+            <version>3.0.3.RELEASE</version>
+        </dependency>
+        <dependency>
+            <groupId>javax.annotation</groupId>
+            <artifactId>jsr250-api</artifactId>
+            <version>1.0</version>
+        </dependency>
+        <dependency>
+            <groupId>cglib</groupId>
+            <artifactId>cglib</artifactId>
+            <version>2.1</version>
+        </dependency>
+        <dependency>
+            <groupId>asm</groupId>
+            <artifactId>asm</artifactId>
+            <version>1.5.3</version>
+        </dependency>
+
+
+        <dependency>
+            <artifactId>standard</artifactId>
+            <groupId>taglibs</groupId>
+            <version>1.1.2</version>
+            <type>jar</type>
+            <scope>runtime</scope>
+        </dependency>
+    </dependencies>
+
+</project>

Propchange: cxf/trunk/distribution/src/main/release/samples/oauth/server/pom.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/distribution/src/main/release/samples/oauth/server/pom.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/trunk/distribution/src/main/release/samples/oauth/server/pom.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/ClientApp.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/ClientApp.java?rev=1176408&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/ClientApp.java (added)
+++ cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/ClientApp.java Tue Sep 27 14:47:30 2011
@@ -0,0 +1,60 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package demo.oauth.server;
+
+import java.io.Serializable;
+
+public class ClientApp implements Serializable {
+    private String clientName = "OAuth 1.0a client";
+    private String callbackURL = "http://localhost:8080/app/callback";
+    private String consumerKey;
+    private String error;
+
+    public String getClientName() {
+        return clientName;
+    }
+
+    public void setClientName(String clientName) {
+        this.clientName = clientName;
+    }
+
+    public String getCallbackURL() {
+        return callbackURL;
+    }
+
+    public void setCallbackURL(String callbackURL) {
+        this.callbackURL = callbackURL;
+    }
+
+    public String getError() {
+        return error;
+    }
+
+    public void setError(String error) {
+        this.error = error;
+    }
+
+    public String getConsumerKey() {
+        return consumerKey;
+    }
+
+    public void setConsumerKey(String consumerKey) {
+        this.consumerKey = consumerKey;
+    }
+}

Propchange: cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/ClientApp.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/ClientApp.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/CustomAuth.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/CustomAuth.java?rev=1176408&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/CustomAuth.java (added)
+++ cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/CustomAuth.java Tue Sep 27 14:47:30 2011
@@ -0,0 +1,18 @@
+package demo.oauth.server;
+
+import java.io.IOException;
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.springframework.security.core.AuthenticationException;
+import org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint;
+
+
+public class CustomAuth extends LoginUrlAuthenticationEntryPoint {
+    @Override
+    public void commence(HttpServletRequest request, HttpServletResponse response,
+                         AuthenticationException authException) throws IOException, ServletException {
+        super.commence(request, response, authException);
+    }
+}

Propchange: cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/CustomAuth.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/CustomAuth.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/SampleResourceProvider.java
URL: http://svn.apache.org/viewvc/cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/SampleResourceProvider.java?rev=1176408&view=auto
==============================================================================
--- cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/SampleResourceProvider.java (added)
+++ cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/SampleResourceProvider.java Tue Sep 27 14:47:30 2011
@@ -0,0 +1,54 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package demo.oauth.server;
+
+import javax.annotation.security.RolesAllowed;
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+
+import org.springframework.security.access.annotation.Secured;
+
+/**
+ * Sample JAX-RS resource service
+ */
+@Path("/")
+public class SampleResourceProvider {
+
+    @GET
+    @Produces("text/html")
+    @Path("/person/get/{name}")
+    @Secured ({"ROLE_USER"})
+    public Response getInfo(@PathParam("name") String name, @Context HttpServletRequest request) {
+        return Response.ok("Successfully accessed OAuth protected person: " + name).build();
+    }
+
+    @POST
+    @Produces("text/html")
+    @Path("/person/modify/{name}")
+    @Secured( {"ROLE_ADMIN"})
+    public Response modifyInfo(@PathParam("name") String name, @Context HttpServletRequest request) {
+        return Response.ok("Successfully modified OAuth protected person: " + name).build();
+    }
+}

Propchange: cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/SampleResourceProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/trunk/distribution/src/main/release/samples/oauth/server/src/main/java/demo/oauth/server/SampleResourceProvider.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date



Mime
View raw message