cxf-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lmo...@apache.org
Subject svn commit: r981471 [2/2] - in /cxf/sandbox/oauth_1.0a: distribution/src/main/release/samples/ distribution/src/main/release/samples/oauth_1.0a/ distribution/src/main/release/samples/oauth_1.0a/client/ distribution/src/main/release/samples/oauth_1.0a/c...
Date Mon, 02 Aug 2010 12:06:56 GMT
Modified: cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/WEB-INF/oauth-beans.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/WEB-INF/oauth-beans.xml?rev=981471&r1=979824&r2=981471&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/WEB-INF/oauth-beans.xml (original)
+++ cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/WEB-INF/oauth-beans.xml Mon Aug  2 12:06:53 2010
@@ -60,7 +60,7 @@
 
     <!--Redirects from Resource Owner Authorization Endpoint to sign in page-->
     <bean id="dispatchProvider" class="org.apache.cxf.jaxrs.provider.RequestDispatcherProvider">
-        <property name="resourcePath" value="/login.jsp"/>
+        <property name="resourcePath" value="/oAuthLogin.jsp"/>
     </bean>
 
     <!-- Endpoint serves OAuth protected resource -->
@@ -74,7 +74,7 @@
     </jaxrs:server>
 
     <!-- Resource Provider -->
-    <bean id="resource" class="org.apache.cxf.rs.auth.oauth.demo.SampleResourceProvider"/>
+    <bean id="resource" class="org.apache.cxf.auth.oauth.demo.server.SampleResourceProvider"/>
 
     <!-- Intercept request to OAuth protected resources -->
     <bean id="oauthSecurityInterceptor"
@@ -83,32 +83,16 @@
     </bean>
 
     <!--OAuth data provider -->
-    <bean id="oauthDataProvider" class="org.apache.cxf.auth.oauth.provider.OAuthDataProviderImpl">
-        <property name="clientAuthInfo">
-            <map key-type="java.lang.String"
-                 value-type="org.apache.cxf.auth.oauth.provider.ClientAuthenticationInfo">
-                <entry key="12345678" value-ref="clientAuthInfo"/>
-            </map>
-        </property>
-    </bean>
-
-    <!--Init OAuth provider with sample data-->
-    <bean id="clientAuthInfo" class="org.apache.cxf.auth.oauth.provider.ClientAuthenticationInfoImpl">
-        <constructor-arg value="12345678"/>
-        <constructor-arg value="secret"/>
-        <constructor-arg value="http://localhost:8080/app/callback"/>
-        <constructor-arg value="OAuth 1.0 sample app"/>
-    </bean>
-
+    <bean id="oauthDataProvider" class="org.apache.cxf.auth.oauth.provider.OAuthDataProviderImpl"/>
 
     <!--Definitions of OAuth module endpoints-->
     <bean id="resourceOwnerAuthorizationEndpoint"
-          class="org.apache.cxf.auth.oauth.endpoints.ResourceOwnerAuthorizationServiceImpl">
+          class="org.apache.cxf.auth.oauth.endpoints.AuthorizationServiceImpl">
         <property name="oAuthDataProvider" ref="oauthDataProvider"/>
     </bean>
 
     <bean id="confirmationService"
-          class="org.apache.cxf.auth.oauth.endpoints.ResourceOwnerAuthorizationConfirmationServiceImpl">
+          class="org.apache.cxf.auth.oauth.endpoints.AuthzConfirmationServiceImpl">
         <property name="oAuthDataProvider" ref="oauthDataProvider"/>
     </bean>
 

Modified: cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/WEB-INF/security-beans.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/WEB-INF/security-beans.xml?rev=981471&r1=979824&r2=981471&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/WEB-INF/security-beans.xml (original)
+++ cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/WEB-INF/security-beans.xml Mon Aug  2 12:06:53 2010
@@ -24,16 +24,16 @@
                         http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.4.xsd">
 
     <!--returns request params from sign in page to confirmation endpoint-->
-    <beans:bean id="oauthTargetURLResolver" class="org.apache.cxf.rs.auth.oauth.demo.TargetURLResolver">
+    <beans:bean id="oauthTargetURLResolver" class="org.apache.cxf.auth.oauth.demo.server.spring.TargetURLResolver">
         <beans:property name="confirmationUrl" value="/auth/oauth/confirm"/>
     </beans:bean>
 
 
     <beans:bean id="customAuthenticationProcessingFilter"
-                class="org.apache.cxf.rs.auth.oauth.demo.OAuthAuthenticationProcessingFilter">
+                class="org.apache.cxf.auth.oauth.demo.server.spring.OAuthAuthenticationProcessingFilter">
         <custom-filter position="AUTHENTICATION_PROCESSING_FILTER"/>
         <!--defaultTargetUrl is overwritten by oauthTargetURLResolver for oauth purposes-->
-        <beans:property name="defaultTargetUrl" value="/doesnt/matter"/>
+        <beans:property name="defaultTargetUrl" value="/app/newAppForm.jsp"/>
         <beans:property name="authenticationManager" ref="authenticationManager"/>
         <beans:property name="authenticationFailureUrl" value="/auth/oauth/authorize"/>
         <beans:property name="allowSessionCreation" value="true"/>
@@ -43,11 +43,11 @@
 
     <beans:bean id="myAuthenticationEntryPoint"
                 class="org.springframework.security.ui.webapp.AuthenticationProcessingFilterEntryPoint">
-        <beans:property name="loginFormUrl" value="/login.jsp"/>
+        <beans:property name="loginFormUrl" value="/index.jsp"/>
     </beans:bean>
 
     <http entry-point-ref="myAuthenticationEntryPoint" auto-config="false">
-        <intercept-url pattern="/login.jsp" filters="none"/>
+        <intercept-url pattern="/oAuthLogin.jsp" filters="none"/>
         <intercept-url pattern="/index.jsp" filters="none"/>
         <intercept-url pattern="/" filters="none"/>
         <intercept-url pattern="/auth/oauth/**" filters="none"/>

Copied: cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/WEB-INF/spring-servlet.xml (from r979824, cxf/sandbox/oauth_1.0a/rt/rs/oauth_demo/server/src/main/webapp/WEB-INF/oauth-beans.xml)
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/WEB-INF/spring-servlet.xml?p2=cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/WEB-INF/spring-servlet.xml&p1=cxf/sandbox/oauth_1.0a/rt/rs/oauth_demo/server/src/main/webapp/WEB-INF/oauth-beans.xml&r1=979824&r2=981471&rev=981471&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/rs/oauth_demo/server/src/main/webapp/WEB-INF/oauth-beans.xml (original)
+++ cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/WEB-INF/spring-servlet.xml Mon Aug  2 12:06:53 2010
@@ -1,4 +1,3 @@
-<?xml version="1.0" encoding="UTF-8"?>
 <!--
   Licensed to the Apache Software Foundation (ASF) under one
   or more contributor license agreements. See the NOTICE file
@@ -18,107 +17,20 @@
   under the License.
 -->
 <beans xmlns="http://www.springframework.org/schema/beans"
-       xmlns:beans="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-       xmlns:sec="http://cxf.apache.org/configuration/security"
-       xmlns:http="http://cxf.apache.org/transports/http/configuration"
-       xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration"
-       xmlns:jaxws="http://java.sun.com/xml/ns/jaxws" xmlns:jaxrs="http://cxf.apache.org/jaxrs"
-       xsi:schemaLocation="http://cxf.apache.org/configuration/security
-  		      http://cxf.apache.org/schemas/configuration/security.xsd
-            http://cxf.apache.org/transports/http/configuration
-            http://cxf.apache.org/schemas/configuration/http-conf.xsd
-            http://cxf.apache.org/transports/http-jetty/configuration
-            http://cxf.apache.org/schemas/configuration/http-jetty.xsd
-            http://www.springframework.org/schema/beans
-            http://www.springframework.org/schema/beans/spring-beans-2.0.xsd http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd">
-
-    <import resource="classpath:META-INF/cxf/cxf.xml"/>
-    <import resource="classpath:META-INF/cxf/cxf-extension-jaxrs-binding.xml"/>
-    <import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>
-    <import resource="classpath:META-INF/cxf/cxf-extension-http.xml"/>
-    <import resource="classpath:META-INF/cxf/cxf-extension-xml.xml"/>
-
-
-    <!-- Publish OAuth endpoints-->
-    <jaxrs:server id="oauthServer" address="/oauth/">
-        <jaxrs:serviceBeans>
-            <ref bean="temporaryCredentialService"/>
-            <ref bean="confirmationService"/>
-            <ref bean="tokenService"/>
-        </jaxrs:serviceBeans>
-    </jaxrs:server>
-
-    <jaxrs:server id="oauthAuthorization" address="/oauth/authorize">
-        <jaxrs:serviceBeans>
-            <ref bean="resourceOwnerAuthorizationEndpoint"/>
-        </jaxrs:serviceBeans>
-        <jaxrs:providers>
-            <ref bean="dispatchProvider"/>
-        </jaxrs:providers>
-    </jaxrs:server>
-
-    <!--Redirects from Resource Owner Authorization Endpoint to sign in page-->
-    <bean id="dispatchProvider" class="org.apache.cxf.jaxrs.provider.RequestDispatcherProvider">
-        <property name="resourcePath" value="/login.jsp"/>
-    </bean>
-
-    <!-- Endpoint serves OAuth protected resource -->
-    <jaxrs:server id="resourceServer" address="/resources/">
-        <jaxrs:serviceBeans>
-            <ref bean="resource"/>
-        </jaxrs:serviceBeans>
-        <jaxrs:inInterceptors>
-            <ref bean="oauthSecurityInterceptor"/>
-        </jaxrs:inInterceptors>
-    </jaxrs:server>
-
-    <!-- Resource Provider -->
-    <bean id="resource" class="org.apache.cxf.rs.auth.oauth.demo.SampleResourceProvider"/>
-
-    <!-- Intercept request to OAuth protected resources -->
-    <bean id="oauthSecurityInterceptor"
-          class="org.apache.cxf.auth.oauth.interceptors.OAuthSecurityInterceptor">
-        <property name="oAuthDataProvider" ref="oauthDataProvider"/>
-    </bean>
-
-    <!--OAuth data provider -->
-    <bean id="oauthDataProvider" class="org.apache.cxf.auth.oauth.provider.OAuthDataProviderImpl">
-        <property name="clientAuthInfo">
-            <map key-type="java.lang.String"
-                 value-type="org.apache.cxf.auth.oauth.provider.ClientAuthenticationInfo">
-                <entry key="12345678" value-ref="clientAuthInfo"/>
-            </map>
-        </property>
+       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="org.apache.cxf.auth.oauth.demo.server.controllers"/>
+
+    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
+        <property name="prefix" value="/WEB-INF/views/"/>
+        <property name="suffix" value=".jsp"/>
     </bean>
 
-    <!--Init OAuth provider with sample data-->
-    <bean id="clientAuthInfo" class="org.apache.cxf.auth.oauth.provider.ClientAuthenticationInfoImpl">
-        <constructor-arg value="12345678"/>
-        <constructor-arg value="secret"/>
-        <constructor-arg value="http://localhost:8080/app/callback"/>
-        <constructor-arg value="OAuth 1.0 sample app"/>
-    </bean>
-
-
-    <!--Definitions of OAuth module endpoints-->
-    <bean id="resourceOwnerAuthorizationEndpoint"
-          class="org.apache.cxf.auth.oauth.endpoints.ResourceOwnerAuthorizationServiceImpl">
-        <property name="oAuthDataProvider" ref="oauthDataProvider"/>
-    </bean>
-
-    <bean id="confirmationService"
-          class="org.apache.cxf.auth.oauth.endpoints.ResourceOwnerAuthorizationConfirmationServiceImpl">
-        <property name="oAuthDataProvider" ref="oauthDataProvider"/>
-    </bean>
-
-    <bean id="tokenService"
-          class="org.apache.cxf.auth.oauth.endpoints.TokenCredentialsServiceImpl">
-        <property name="oAuthDataProvider" ref="oauthDataProvider"/>
-    </bean>
-
-    <bean id="temporaryCredentialService"
-          class="org.apache.cxf.auth.oauth.endpoints.TemporaryCredentialServiceImpl">
-        <property name="oAuthDataProvider" ref="oauthDataProvider"/>
-    </bean>
 </beans>
\ No newline at end of file

Propchange: cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/WEB-INF/spring-servlet.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/WEB-INF/spring-servlet.xml
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Propchange: cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/WEB-INF/spring-servlet.xml
------------------------------------------------------------------------------
    svn:mime-type = text/xml

Added: cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/WEB-INF/views/applicationDetails.jsp
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/WEB-INF/views/applicationDetails.jsp?rev=981471&view=auto
==============================================================================
--- cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/WEB-INF/views/applicationDetails.jsp (added)
+++ cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/WEB-INF/views/applicationDetails.jsp Mon Aug  2 12:06:53 2010
@@ -0,0 +1,63 @@
+<!--
+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="clientInfo" type="org.apache.cxf.auth.oauth.provider.ClientAuthenticationInfo"--%>
+<%@ 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>Application Details</title></head>
+<body>
+
+<table>
+    <form:form action="/app/newAppForm">
+        <tr>
+            <td>Application Name:</td>
+            <td>${clientInfo.applicationName}</td>
+        </tr>
+        <tr>
+            <td>Customer Key:</td>
+            <td>${clientInfo.consumerKey}</td>
+        </tr>
+        <tr>
+            <td>Consumer Secret:</td>
+            <td>${clientInfo.secretKey}</td>
+        </tr>
+        <tr>
+            <td>Callback URL:</td>
+            <td>${clientInfo.callbackURL}</td>
+        </tr>
+        <tr>
+            <td colspan="2">
+                <input type="submit" value="Register New App"/>
+            </td>
+        </tr>
+    </form:form>
+    <tr>
+        <td>
+            <form:form action="/app/listRegisteredApps">
+                <input type="submit" value="List Registered Apps"/>
+            </form:form>
+        </td>
+    </tr>
+
+</table>
+
+</body>
+</html>

Copied: cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/WEB-INF/views/newAppForm.jsp (from r979824, cxf/sandbox/oauth_1.0a/rt/rs/oauth_demo/server/src/main/webapp/index.jsp)
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/WEB-INF/views/newAppForm.jsp?p2=cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/WEB-INF/views/newAppForm.jsp&p1=cxf/sandbox/oauth_1.0a/rt/rs/oauth_demo/server/src/main/webapp/index.jsp&r1=979824&r2=981471&rev=981471&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/rs/oauth_demo/server/src/main/webapp/index.jsp (original)
+++ cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/WEB-INF/views/newAppForm.jsp Mon Aug  2 12:06:53 2010
@@ -16,27 +16,33 @@ KIND, either express or implied. See the
 specific language governing permissions and limitations
 under the License.
 -->
-<%--@elvariable id="text" type="java.lang.String"--%>
-<%--@elvariable id="oauthauthorizationdata" type="org.apache.cxf.auth.oauth.provider.OAuthAuthorizationData"--%>
+<%--@elvariable id="application" type="org.apache.cxf.auth.oauth.demo.server.Application"--%>
 <%@ 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 CXF server</title></head>
+<head><title>Create new application</title></head>
 <body>
-<table align="center">
-    <tr align="center">
-        <td><h2>Sample CXF-OAuth 1.0a server implementation</h2></td>
-    </tr>
-
-    <tr align="center">
-        <td><h3>OAuth protected resources at: </h3></td>
-    </tr>
-    <tr align="center">
-        <td><input size="70" value="http://localhost:8081/auth/resources/person/{name}"/><br/><br/>
-        You can access this resources by using OAuth client hosted at: <a href="http://www.oauthclient.appspot.com/">OAuth client</a></td>
-    </tr>
-</table>
+<form:form commandName="application" action="/app/registerApp">
+    <c:if test="${!empty application.error}">
+        <font color="red"><p>Error: ${application.error}</p></font>
+    </c:if>
+    <table>
+        <tr>
+            <td>Application Name:</td>
+            <td><form:input size="70" path="applicationName"/></td>
+        </tr>
+        <tr>
+            <td>Callback URL:</td>
+            <td><form:input size="70" path="callbackURL"/></td>
+        </tr>
+        <tr>
+            <td colspan="2">
+                <input type="submit" value="Register Application"/>
+            </td>
+        </tr>
+    </table>
+</form:form>
 </body>
 </html>

Added: cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/WEB-INF/views/registeredAppsList.jsp
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/WEB-INF/views/registeredAppsList.jsp?rev=981471&view=auto
==============================================================================
--- cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/WEB-INF/views/registeredAppsList.jsp (added)
+++ cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/WEB-INF/views/registeredAppsList.jsp Mon Aug  2 12:06:53 2010
@@ -0,0 +1,59 @@
+<!--
+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="apps" type="java.util.Set<org.apache.cxf.auth.oauth.provider.ClientAuthNInfo>"--%>
+<%@ 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>Registered Applications</title></head>
+<body>
+<form:form action="/app/newAppForm">
+    <table>
+        <c:forEach var="app" items="${apps}">
+            <tr>
+                <td>Application Name:</td>
+                <td>${app.applicationName}</td>
+            </tr>
+            <tr>
+                <td>Customer Key:</td>
+                <td>${app.consumerKey}</td>
+            </tr>
+            <tr>
+                <td>Consumer Secret:</td>
+                <td>${app.secretKey}</td>
+            </tr>
+            <tr>
+                <td>Callback URL:</td>
+                <td>${app.callbackURL}</td>
+            </tr>
+            <tr>
+                <td>&nbsp;</td>
+                <td>&nbsp;</td>
+            </tr>
+        </c:forEach>
+        <tr>
+            <td colspan="2">
+                <input type="submit" value="Register New App"/>
+            </td>
+        </tr>
+    </table>
+</form:form>
+</body>
+</html>

Modified: cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/WEB-INF/web.xml?rev=981471&r1=979824&r2=981471&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/WEB-INF/web.xml (original)
+++ cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/WEB-INF/web.xml Mon Aug  2 12:06:53 2010
@@ -20,9 +20,12 @@
 <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"
-         version="2.5">
+         http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+         metadata-complete="true" version="2.5">
 
+
+    <!-- **************** Spring configuration *****************-->
+    
     <context-param>
         <param-name>contextConfigLocation</param-name>
         <param-value>/WEB-INF/*-beans.xml</param-value>
@@ -44,6 +47,18 @@
     </filter-mapping>
 
     <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>
+
+    <!-- **************** CXF configuration *****************-->
+    <servlet>
         <servlet-name>CXFServlet</servlet-name>
         <servlet-class>
             org.apache.cxf.transport.servlet.CXFServlet

Modified: cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/index.jsp
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/index.jsp?rev=981471&r1=979824&r2=981471&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/index.jsp (original)
+++ cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/index.jsp Mon Aug  2 12:06:53 2010
@@ -35,8 +35,44 @@ under the License.
     </tr>
     <tr align="center">
         <td><input size="70" value="http://localhost:8081/auth/resources/person/{name}"/><br/><br/>
-        You can access this resources by using OAuth client hosted at: <a href="http://www.oauthclient.appspot.com/">OAuth client</a></td>
+            You can access this resources by using OAuth client hosted at: <a
+                    href="http://www.oauthclient.appspot.com/">OAuth client</a></td>
     </tr>
 </table>
+<br/><br/>
+<table align="center">
+    <tr align="center">
+        <td><h3>Login with Username and Password to register OAuth client</h3></td>
+    </tr>
+
+    <tr>
+        <td>User: user1</td>
+    </tr>
+    <tr>
+        <td>Password: 1111</td>
+    </tr>
+    <tr align="center">
+        <td>
+            <form name="f" action="/j_spring_security_check" method="POST">
+                <c:if test="${not empty param.login_error}">
+                    <font color="red">
+                        Your login attempt was not successful, try again.<br/><br/>
+                        Reason: <c:out value="${SPRING_SECURITY_LAST_EXCEPTION.message}"/>.
+                    </font>
+                </c:if>
+                <label for="login">User</label>
+                <input type="text" id="login" name='j_username'
+                       value='<c:if test="${not empty param.login_error}"><c:out value="${SPRING_SECURITY_LAST_USERNAME}"/></c:if>'/>
+
+                <div class="clear"></div>
+                <label for="password">Password</label>
+                <input type="password" id="password" name="j_password"/>
+                <br>
+                <input type="submit" class="button" name="commit" value="Log in"/>
+            </form>
+        </td>
+    </tr>
+</table>
+
 </body>
 </html>

Added: cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/oAuthLogin.jsp
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/oAuthLogin.jsp?rev=981471&view=auto
==============================================================================
--- cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/oAuthLogin.jsp (added)
+++ cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/oauth_1.0a/server/src/main/webapp/oAuthLogin.jsp Mon Aug  2 12:06:53 2010
@@ -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="oauthauthorizationdata" type="org.apache.cxf.auth.oauth.provider.OAuthAuthorizationData"--%>
+<%@ 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 CXF server</title></head>
+<body>
+<table align="center">
+    <tr>
+        <td><h2>Sample CXF-OAuth 1.0a server implementation</h2></td>
+    </tr>
+</table>
+<c:choose>
+    <c:when test="${!empty oauthauthorizationdata.oauthToken && !empty oauthauthorizationdata.securityToken}">
+        <table align="center">
+            <tr align="center">
+                <td><h3>Login with Username and Password</h3></td>
+            </tr>
+
+            <tr>
+                <td>User: user1</td>
+            </tr>
+            <tr>
+                <td>Password: 1111</td>
+            </tr>
+            <tr align="center">
+                <td>
+                    <form name="f" action="/j_spring_security_check" method="POST">
+                        <input type="hidden" name="oauth_token" value="${oauthauthorizationdata.oauthToken}"/>
+                        <input type="hidden" name="sec_token"
+                               value="${oauthauthorizationdata.securityToken}"/>
+
+                        <p>The application <b>${oauthauthorizationdata.applicationName}</b> would like the
+                            ability to access and update your data on Sample OAuth CXF server.
+                            <br/>
+                            Please ensure that you trust this website with your information before
+                            proceeding!</p>
+                        <c:if test="${not empty param.login_error}">
+                            <font color="red">
+                                Your login attempt was not successful, try again.<br/><br/>
+                                Reason: <c:out value="${SPRING_SECURITY_LAST_EXCEPTION.message}"/>.
+                            </font>
+                        </c:if>
+                        <label for="login">User</label>
+                        <input type="text" id="login" name='j_username'
+                               value='<c:if test="${not empty param.login_error}"><c:out value="${SPRING_SECURITY_LAST_USERNAME}"/></c:if>'/>
+
+                        <div class="clear"></div>
+                        <label for="password">Password</label>
+                        <input type="password" id="password" name="j_password"/>
+                        <br>
+                        <input type="submit" class="button" name="commit" value="Log in"/>
+                    </form>
+                </td>
+            </tr>
+        </table>
+    </c:when>
+    <c:otherwise>
+        <h3>Invalid request</h3>
+    </c:otherwise>
+</c:choose>
+</body>
+</html>
\ No newline at end of file

Modified: cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/pom.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/pom.xml?rev=981471&r1=981470&r2=981471&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/pom.xml (original)
+++ cxf/sandbox/oauth_1.0a/distribution/src/main/release/samples/pom.xml Mon Aug  2 12:06:53 2010
@@ -82,6 +82,8 @@
         <module>jaxws_handlers</module>
         <module>wsdl_first_rpclit</module>
         <module>jms_pubsub</module>
+        <module>oauth_1.0a/client</module>
+        <module>oauth_1.0a/server</module>
 
         <!--
         these are a bit fragile as they need to go off to external sites to get stuff like

Modified: cxf/sandbox/oauth_1.0a/parent/pom.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/parent/pom.xml?rev=981471&r1=981470&r2=981471&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/parent/pom.xml (original)
+++ cxf/sandbox/oauth_1.0a/parent/pom.xml Mon Aug  2 12:06:53 2010
@@ -73,6 +73,7 @@
         <wsdl4j.version>1.6.2</wsdl4j.version>
         <xmlbeans.version>2.4.0</xmlbeans.version>
         <xmlschema.version>1.4.6</xmlschema.version>
+        <oauth.version>20100527</oauth.version>
         <checkstyle.extension />
 
         <spring.validation.mode>VALIDATION_AUTO</spring.validation.mode>
@@ -482,7 +483,7 @@
                         <groupId>org.codehaus.woodstox</groupId>
                         <artifactId>wstx-asl</artifactId>
                     </exclusion>
- 
+
 
                 </exclusions>
             </dependency>
@@ -1168,6 +1169,11 @@
                 <artifactId>msv-core</artifactId>
                 <version>${msv.version}</version>
             </dependency>
+            <dependency>
+                <groupId>net.oauth.core</groupId>
+                <artifactId>oauth-provider</artifactId>
+                <version>${oauth.version}</version>
+            </dependency>
         </dependencies>
     </dependencyManagement>
 
@@ -1408,7 +1414,7 @@
             <properties>
                 <spring.version>3.0.0.RELEASE</spring.version>
             </properties>
-        </profile> 
+        </profile>
         <profile>
             <!-- Profile to clean even if you do not have the cxf plugins in
              your local mavven repo -->

Modified: cxf/sandbox/oauth_1.0a/rt/rs/oauth/pom.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/rs/oauth/pom.xml?rev=981471&r1=981470&r2=981471&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/rs/oauth/pom.xml (original)
+++ cxf/sandbox/oauth_1.0a/rt/rs/oauth/pom.xml Mon Aug  2 12:06:53 2010
@@ -24,7 +24,7 @@
     <artifactId>cxf-rt-rs-oauth</artifactId>
     <version>2.3.0-SNAPSHOT</version>
     <packaging>jar</packaging>
-    <name>Apache CXF OAuth 1.0a</name>
+    <name>Apache CXF Runtime OAuth 1.0a</name>
     <url>http://cxf.apache.org</url>
 
     <parent>
@@ -38,23 +38,21 @@
         <dependency>
             <groupId>org.apache.cxf</groupId>
             <artifactId>cxf-rt-frontend-jaxrs</artifactId>
-            <version>2.3.0-SNAPSHOT</version>
-            <scope>provided</scope>
-        </dependency>
+            <version>${project.version}</version>
+        </dependency>     
         <dependency>
-            <groupId>org.apache.geronimo.specs</groupId>
-            <artifactId>geronimo-servlet_2.5_spec</artifactId>
-            <scope>provided</scope>
+            <groupId>${servlet-api.group}</groupId>
+            <artifactId>${servlet-api.artifact}</artifactId>
+            <version>${servlet-api.version}</version>
         </dependency>
         <dependency>
-            <groupId>net.oauth.core</groupId>
-            <artifactId>oauth</artifactId>
-            <version>20100527</version>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-rt-transports-http-jetty</artifactId>
         </dependency>
+        
         <dependency>
             <groupId>net.oauth.core</groupId>
             <artifactId>oauth-provider</artifactId>
-            <version>20100527</version>
         </dependency>
 
         <!--test dependencies-->
@@ -65,8 +63,8 @@
         </dependency>
         <dependency>
             <groupId>org.springframework</groupId>
-            <artifactId>spring-test</artifactId>
-            <version>2.5.6</version>
+            <artifactId>${spring.mock}</artifactId>
+            <version>${spring.version}</version>
             <scope>test</scope>
         </dependency>
         <dependency>
@@ -87,7 +85,7 @@
         <repository>
             <id>oauth</id>
             <name>OAuth Repository</name>
-            <url>http://oauth.googlecode.com/svn/code/maven</url>
+            <url>http://oauth.googlecode.com/svn/code/maven/</url>
         </repository>
     </repositories>
 </project>
\ No newline at end of file

Copied: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/AuthorizationService.java (from r979824, cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/ResourceOwnerAuthorizationService.java)
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/AuthorizationService.java?p2=cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/AuthorizationService.java&p1=cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/ResourceOwnerAuthorizationService.java&r1=979824&r2=981471&rev=981471&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/ResourceOwnerAuthorizationService.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/AuthorizationService.java Mon Aug  2 12:06:53 2010
@@ -29,9 +29,9 @@ import javax.ws.rs.core.Response;
  * @author Lukasz Moren
  */
 @Path("/")
-public interface ResourceOwnerAuthorizationService {
+public interface AuthorizationService {
 
-    public static final String SEC_TOKEN = "sec_token";
+    String SEC_TOKEN = "sec_token";
 
     @GET
     @Path("/")

Propchange: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/AuthorizationService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/AuthorizationService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/AuthorizationServiceImpl.java (from r979824, cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/ResourceOwnerAuthorizationServiceImpl.java)
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/AuthorizationServiceImpl.java?p2=cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/AuthorizationServiceImpl.java&p1=cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/ResourceOwnerAuthorizationServiceImpl.java&r1=979824&r2=981471&rev=981471&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/ResourceOwnerAuthorizationServiceImpl.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/AuthorizationServiceImpl.java Mon Aug  2 12:06:53 2010
@@ -29,6 +29,12 @@ import javax.ws.rs.Path;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.Response;
 
+import net.oauth.OAuth;
+import net.oauth.OAuthException;
+import net.oauth.OAuthMessage;
+import net.oauth.OAuthProblemException;
+import net.oauth.server.OAuthServlet;
+
 import org.apache.cxf.auth.oauth.provider.OAuthAuthorizationData;
 import org.apache.cxf.auth.oauth.provider.OAuthDataProvider;
 import org.apache.cxf.auth.oauth.provider.RequestToken;
@@ -36,19 +42,14 @@ import org.apache.cxf.auth.oauth.utils.O
 import org.apache.cxf.auth.oauth.validation.OAuthMessageValidator;
 import org.apache.cxf.common.logging.LogUtils;
 
-import net.oauth.OAuth;
-import net.oauth.OAuthException;
-import net.oauth.OAuthMessage;
-import net.oauth.OAuthProblemException;
-import net.oauth.server.OAuthServlet;
 
 /**
  * @author Lukasz Moren
  */
 @Path("/")
-public class ResourceOwnerAuthorizationServiceImpl implements ResourceOwnerAuthorizationService {
+public class AuthorizationServiceImpl implements AuthorizationService {
 
-    private static final Logger LOG = LogUtils.getL7dLogger(ResourceOwnerAuthorizationServiceImpl.class);
+    private static final Logger LOG = LogUtils.getL7dLogger(AuthorizationServiceImpl.class);
 
     private OAuthDataProvider oAuthDataProvider;
 
@@ -107,8 +108,8 @@ public class ResourceOwnerAuthorizationS
         secData.setApplicationName(token.getClientAuthenticationInfo().getApplicationName());
     }
 
-    public void setoAuthDataProvider(OAuthDataProvider oAuthDataProvider) {
-        this.oAuthDataProvider = oAuthDataProvider;
+    public void setoAuthDataProvider(OAuthDataProvider provider) {
+        this.oAuthDataProvider = provider;
     }
 
 }

Propchange: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/AuthorizationServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/AuthorizationServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/AuthzConfirmationService.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/AuthzConfirmationService.java?rev=981471&view=auto
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/AuthzConfirmationService.java (added)
+++ cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/AuthzConfirmationService.java Mon Aug  2 12:06:53 2010
@@ -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 org.apache.cxf.auth.oauth.endpoints;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+
+
+/**
+ * @author Lukasz Moren
+ */
+@Path("/confirm")
+public interface AuthzConfirmationService {
+
+    @GET
+    @Produces("application/x-www-form-urlencoded")
+    Response confirmUserDecision(@Context HttpServletRequest request);
+}
\ No newline at end of file

Propchange: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/AuthzConfirmationService.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/AuthzConfirmationService.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/AuthzConfirmationServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/AuthzConfirmationServiceImpl.java?rev=981471&view=auto
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/AuthzConfirmationServiceImpl.java (added)
+++ cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/AuthzConfirmationServiceImpl.java Mon Aug  2 12:06:53 2010
@@ -0,0 +1,102 @@
+/**
+ * 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 org.apache.cxf.auth.oauth.endpoints;
+
+import java.io.IOException;
+import java.net.URI;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.Response;
+
+import net.oauth.OAuth;
+import net.oauth.OAuthMessage;
+import net.oauth.OAuthProblemException;
+import net.oauth.server.OAuthServlet;
+
+import org.apache.cxf.auth.oauth.provider.ClientAuthNInfo;
+import org.apache.cxf.auth.oauth.provider.OAuthDataProvider;
+import org.apache.cxf.auth.oauth.provider.RequestToken;
+import org.apache.cxf.auth.oauth.utils.OAuthUtils;
+import org.apache.cxf.common.logging.LogUtils;
+
+/**
+ * Service is called after successfull resource owner authorization
+ *
+ * @author Lukasz Moren
+ */
+@Path("/confirm")
+public class AuthzConfirmationServiceImpl implements AuthzConfirmationService {
+
+    private static final Logger LOG = LogUtils
+        .getL7dLogger(AuthzConfirmationServiceImpl.class);
+
+    private OAuthDataProvider oAuthDataProvider;
+
+    @GET
+    @Produces("application/x-www-form-urlencoded")
+    public Response confirmUserDecision(@Context HttpServletRequest request) {
+        // service called from confirmation page
+        try {
+
+            OAuthMessage oAuthMessage = OAuthServlet.getMessage(request, request.getRequestURL().toString());
+            oAuthMessage.requireParameters(OAuth.OAUTH_TOKEN, AuthorizationService.SEC_TOKEN);
+
+            // todo how long oauth verifier?, it SHOULD be suitable for manual entry acording to spec
+            // generate oauth verifier
+            RequestToken requestToken = oAuthDataProvider
+                .validateRequestToken(oAuthMessage.getToken(), oAuthMessage
+                    .getParameter(AuthorizationService.SEC_TOKEN));
+
+            ClientAuthNInfo clientInfo = requestToken.getClientAuthenticationInfo();
+            StringBuffer callback = new StringBuffer(clientInfo.getCallbackURL()).append("?oauth_token=")
+                .append(oAuthMessage.getToken()).append("&oauth_verifier=").append(
+                    requestToken
+                        .getOauthVerifier());
+
+            return Response.status(HttpServletResponse.SC_MOVED_TEMPORARILY).location(
+                URI.create(callback
+                    .toString()))
+                .build();
+        } catch (OAuthProblemException e) {
+            if (LOG.isLoggable(Level.WARNING)) {
+                LOG.log(Level.WARNING, "An OAuth-related problem: {0}", new Object[] {
+                    e.toString()
+                });
+            }
+            throw OAuthUtils.handleException(e, e.getHttpStatusCode());
+        } catch (IOException e) {
+            if (LOG.isLoggable(Level.SEVERE)) {
+                LOG.log(Level.SEVERE, "OAuth module exception: {0}", new Object[] {
+                    e.toString()
+                });
+            }
+            throw OAuthUtils.handleException(e, HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
+        }
+    }
+
+    public void setoAuthDataProvider(OAuthDataProvider provider) {
+        this.oAuthDataProvider = provider;
+    }
+}

Propchange: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/AuthzConfirmationServiceImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/AuthzConfirmationServiceImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/TemporaryCredentialServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/TemporaryCredentialServiceImpl.java?rev=981471&r1=981470&r2=981471&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/TemporaryCredentialServiceImpl.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/TemporaryCredentialServiceImpl.java Mon Aug  2 12:06:53 2010
@@ -33,13 +33,6 @@ import javax.ws.rs.Produces;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.Response;
 
-import org.apache.cxf.auth.oauth.provider.ClientAuthenticationInfo;
-import org.apache.cxf.auth.oauth.provider.OAuthDataProvider;
-import org.apache.cxf.auth.oauth.provider.RequestToken;
-import org.apache.cxf.auth.oauth.utils.OAuthUtils;
-import org.apache.cxf.auth.oauth.validation.OAuthMessageValidator;
-import org.apache.cxf.common.logging.LogUtils;
-
 import net.oauth.OAuth;
 import net.oauth.OAuthAccessor;
 import net.oauth.OAuthConsumer;
@@ -48,6 +41,13 @@ import net.oauth.OAuthMessage;
 import net.oauth.OAuthProblemException;
 import net.oauth.server.OAuthServlet;
 
+import org.apache.cxf.auth.oauth.provider.ClientAuthNInfo;
+import org.apache.cxf.auth.oauth.provider.OAuthDataProvider;
+import org.apache.cxf.auth.oauth.provider.RequestToken;
+import org.apache.cxf.auth.oauth.utils.OAuthUtils;
+import org.apache.cxf.auth.oauth.validation.OAuthMessageValidator;
+import org.apache.cxf.common.logging.LogUtils;
+
 /**
  * @author Lukasz Moren
  */
@@ -86,11 +86,21 @@ public class TemporaryCredentialServiceI
                 LOG.log(Level.FINE, "All required OAuth parameters are present");
             }
 
-            ClientAuthenticationInfo authenticationInfo = oAuthDataProvider
+            ClientAuthNInfo authNInfo = oAuthDataProvider
                 .getClientAuthenticationInfo(oAuthMessage.getParameter(OAuth.OAUTH_CONSUMER_KEY));
 
+            //client credentials not found
+            if (authNInfo == null) {
+                OAuthProblemException problemEx = new OAuthProblemException(
+                    OAuth.Problems.CONSUMER_KEY_UNKNOWN);
+                problemEx
+                    .setParameter(OAuthProblemException.HTTP_STATUS_CODE,
+                        HttpServletResponse.SC_UNAUTHORIZED);
+                throw problemEx;
+            }
+
             OAuthConsumer consumer = new OAuthConsumer(oAuthMessage.getParameter(OAuth.OAUTH_CALLBACK),
-                authenticationInfo.getConsumerKey(), authenticationInfo.getSecretKey(), null);
+                authNInfo.getConsumerKey(), authNInfo.getSecretKey(), null);
 
             OAuthAccessor accessor = new OAuthAccessor(consumer);
 
@@ -98,10 +108,10 @@ public class TemporaryCredentialServiceI
             oAuthValidator.validateMessage(oAuthMessage, accessor);
 
             //set callback url from request, or use preregistered one
-            authenticationInfo = setCallbackURL(authenticationInfo,
+            authNInfo = setCallbackURL(authNInfo,
                 oAuthMessage.getParameter(OAuth.OAUTH_CALLBACK));
 
-            RequestToken requestToken = oAuthDataProvider.generateRequestToken(authenticationInfo);
+            RequestToken requestToken = oAuthDataProvider.generateRequestToken(authNInfo);
 
             if (LOG.isLoggable(Level.FINE)) {
                 LOG.log(Level.FINE, "Preparing Temporary Credentials Endpoint correct response");
@@ -134,17 +144,17 @@ public class TemporaryCredentialServiceI
         }
     }
 
-    protected ClientAuthenticationInfo setCallbackURL(ClientAuthenticationInfo authenticationInfo,
-                                                      String oauthCallback) {
+    protected ClientAuthNInfo setCallbackURL(ClientAuthNInfo authNInfo,
+                                             String oauthCallback) {
 
-        if (!oauthCallback.equals(ClientAuthenticationInfo.OAUTH_OOB)) {
-            authenticationInfo.setCallbackURL(oauthCallback);
+        if (!oauthCallback.equals(ClientAuthNInfo.OAUTH_OOB)) {
+            authNInfo.setCallbackURL(oauthCallback);
         }
 
-        return authenticationInfo;
+        return authNInfo;
     }
 
-    public void setoAuthDataProvider(OAuthDataProvider oAuthDataProvider) {
-        this.oAuthDataProvider = oAuthDataProvider;
+    public void setoAuthDataProvider(OAuthDataProvider provider) {
+        this.oAuthDataProvider = provider;
     }
 }

Modified: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/TokenCredentialsServiceImpl.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/TokenCredentialsServiceImpl.java?rev=981471&r1=981470&r2=981471&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/TokenCredentialsServiceImpl.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/endpoints/TokenCredentialsServiceImpl.java Mon Aug  2 12:06:53 2010
@@ -33,14 +33,6 @@ import javax.ws.rs.Produces;
 import javax.ws.rs.core.Context;
 import javax.ws.rs.core.Response;
 
-import org.apache.cxf.auth.oauth.provider.AccessToken;
-import org.apache.cxf.auth.oauth.provider.ClientAuthenticationInfo;
-import org.apache.cxf.auth.oauth.provider.OAuthDataProvider;
-import org.apache.cxf.auth.oauth.provider.RequestToken;
-import org.apache.cxf.auth.oauth.utils.OAuthUtils;
-import org.apache.cxf.auth.oauth.validation.OAuthMessageValidator;
-import org.apache.cxf.common.logging.LogUtils;
-
 import net.oauth.OAuth;
 import net.oauth.OAuthAccessor;
 import net.oauth.OAuthConsumer;
@@ -49,6 +41,14 @@ import net.oauth.OAuthMessage;
 import net.oauth.OAuthProblemException;
 import net.oauth.server.OAuthServlet;
 
+import org.apache.cxf.auth.oauth.provider.AccessToken;
+import org.apache.cxf.auth.oauth.provider.ClientAuthNInfo;
+import org.apache.cxf.auth.oauth.provider.OAuthDataProvider;
+import org.apache.cxf.auth.oauth.provider.RequestToken;
+import org.apache.cxf.auth.oauth.utils.OAuthUtils;
+import org.apache.cxf.auth.oauth.validation.OAuthMessageValidator;
+import org.apache.cxf.common.logging.LogUtils;
+
 /**
  * @author Lukasz Moren
  */
@@ -77,7 +77,7 @@ public class TokenCredentialsServiceImpl
             RequestToken token = oAuthDataProvider
                 .getRequestToken(oAuthMessage.getToken(), oAuthMessage.getParameter(OAuth.OAUTH_VERIFIER));
 
-            ClientAuthenticationInfo authInfo = token.getClientAuthenticationInfo();
+            ClientAuthNInfo authInfo = token.getClientAuthenticationInfo();
             OAuthConsumer consumer = new OAuthConsumer(authInfo.getCallbackURL(), authInfo.getConsumerKey(),
                 authInfo.getSecretKey(), null);
             OAuthAccessor accessor = new OAuthAccessor(consumer);
@@ -117,7 +117,7 @@ public class TokenCredentialsServiceImpl
 
     }
 
-    public void setoAuthDataProvider(OAuthDataProvider oAuthDataProvider) {
-        this.oAuthDataProvider = oAuthDataProvider;
+    public void setoAuthDataProvider(OAuthDataProvider provider) {
+        this.oAuthDataProvider = provider;
     }
 }

Modified: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/interceptors/OAuthSecurityInterceptor.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/interceptors/OAuthSecurityInterceptor.java?rev=981471&r1=981470&r2=981471&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/interceptors/OAuthSecurityInterceptor.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/interceptors/OAuthSecurityInterceptor.java Mon Aug  2 12:06:53 2010
@@ -23,8 +23,16 @@ import java.util.logging.Logger;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 
+import net.oauth.OAuth;
+import net.oauth.OAuthAccessor;
+import net.oauth.OAuthConsumer;
+import net.oauth.OAuthException;
+import net.oauth.OAuthMessage;
+import net.oauth.OAuthProblemException;
+import net.oauth.server.OAuthServlet;
+
 import org.apache.cxf.auth.oauth.provider.AccessToken;
-import org.apache.cxf.auth.oauth.provider.ClientAuthenticationInfo;
+import org.apache.cxf.auth.oauth.provider.ClientAuthNInfo;
 import org.apache.cxf.auth.oauth.provider.OAuthDataProvider;
 import org.apache.cxf.auth.oauth.utils.OAuthUtils;
 import org.apache.cxf.auth.oauth.validation.OAuthMessageValidator;
@@ -35,14 +43,6 @@ import org.apache.cxf.phase.AbstractPhas
 import org.apache.cxf.phase.Phase;
 import org.apache.cxf.transport.http.AbstractHTTPDestination;
 
-import net.oauth.OAuth;
-import net.oauth.OAuthAccessor;
-import net.oauth.OAuthConsumer;
-import net.oauth.OAuthException;
-import net.oauth.OAuthMessage;
-import net.oauth.OAuthProblemException;
-import net.oauth.server.OAuthServlet;
-
 /**
  * @author Lukasz Moren
  */
@@ -76,7 +76,7 @@ public class OAuthSecurityInterceptor ex
                 OAuth.OAUTH_NONCE);
 
             AccessToken accessToken = oAuthDataProvider.getAccessToken(oAuthMessage.getToken());
-            ClientAuthenticationInfo authInfo = accessToken.getClientAuthenticationInfo();
+            ClientAuthNInfo authInfo = accessToken.getClientAuthenticationInfo();
 
 
             OAuthConsumer consumer = new OAuthConsumer(authInfo.getCallbackURL(), authInfo.getConsumerKey(),
@@ -109,7 +109,7 @@ public class OAuthSecurityInterceptor ex
         m.getInterceptorChain().abort();
     }
 
-    public void setoAuthDataProvider(OAuthDataProvider oAuthDataProvider) {
-        this.oAuthDataProvider = oAuthDataProvider;
+    public void setoAuthDataProvider(OAuthDataProvider provider) {
+        this.oAuthDataProvider = provider;
     }
 }

Modified: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/AccessToken.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/AccessToken.java?rev=981471&r1=981470&r2=981471&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/AccessToken.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/AccessToken.java Mon Aug  2 12:06:53 2010
@@ -22,8 +22,8 @@ package org.apache.cxf.auth.oauth.provid
  * @author Lukasz Moren
  */
 public class AccessToken extends Token {
-    public AccessToken(ClientAuthenticationInfo clientAuthenticationInfo, String tokenString,
+    public AccessToken(ClientAuthNInfo clientAuthNInfo, String tokenString,
                        String tokenSecret) {
-        super(clientAuthenticationInfo, tokenString, tokenSecret);
+        super(clientAuthNInfo, tokenString, tokenSecret);
     }
 }

Copied: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/ClientAuthNInfo.java (from r979824, cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/ClientAuthenticationInfo.java)
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/ClientAuthNInfo.java?p2=cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/ClientAuthNInfo.java&p1=cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/ClientAuthenticationInfo.java&r1=979824&r2=981471&rev=981471&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/ClientAuthenticationInfo.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/ClientAuthNInfo.java Mon Aug  2 12:06:53 2010
@@ -21,9 +21,9 @@ package org.apache.cxf.auth.oauth.provid
 /**
  * @author Lukasz Moren
  */
-public interface ClientAuthenticationInfo {
+public interface ClientAuthNInfo {
     //oauth calbackurl "out of band" parameter
-    public static final String OAUTH_OOB = "oob";
+    String OAUTH_OOB = "oob";
 
     String getConsumerKey();
 

Propchange: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/ClientAuthNInfo.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/ClientAuthNInfo.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Copied: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/ClientAuthNInfoImpl.java (from r979824, cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/ClientAuthenticationInfoImpl.java)
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/ClientAuthNInfoImpl.java?p2=cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/ClientAuthNInfoImpl.java&p1=cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/ClientAuthenticationInfoImpl.java&r1=979824&r2=981471&rev=981471&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/ClientAuthenticationInfoImpl.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/ClientAuthNInfoImpl.java Mon Aug  2 12:06:53 2010
@@ -21,13 +21,13 @@ package org.apache.cxf.auth.oauth.provid
 /**
  * @author Lukasz Moren
  */
-public class ClientAuthenticationInfoImpl implements ClientAuthenticationInfo {
+public class ClientAuthNInfoImpl implements ClientAuthNInfo {
     private String consumerKey;
     private String secretKey;
     private String callbackURL;
     private String applicationName;
 
-    public ClientAuthenticationInfoImpl(String consumerKey, String secretKey, String callbackURL,
+    public ClientAuthNInfoImpl(String consumerKey, String secretKey, String callbackURL,
                                         String applicationName) {
         this.consumerKey = consumerKey;
         this.secretKey = secretKey;
@@ -35,11 +35,11 @@ public class ClientAuthenticationInfoImp
         this.applicationName = applicationName;
     }
 
-    public ClientAuthenticationInfoImpl(String consumerKey, String secretKey, String callbackURL) {
+    public ClientAuthNInfoImpl(String consumerKey, String secretKey, String callbackURL) {
         this(consumerKey, secretKey, callbackURL, null);
     }
 
-    public ClientAuthenticationInfoImpl(String consumerKey, String secretKey) {
+    public ClientAuthNInfoImpl(String consumerKey, String secretKey) {
         this(consumerKey, secretKey, null);
     }
 
@@ -76,7 +76,7 @@ public class ClientAuthenticationInfoImp
             return false;
         }
 
-        ClientAuthenticationInfoImpl that = (ClientAuthenticationInfoImpl)o;
+        ClientAuthNInfoImpl that = (ClientAuthNInfoImpl)o;
 
         if (applicationName != null ? !applicationName.equals(that.applicationName)
             : that.applicationName != null) {

Propchange: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/ClientAuthNInfoImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/ClientAuthNInfoImpl.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/OAuthDataProvider.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/OAuthDataProvider.java?rev=981471&r1=981470&r2=981471&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/OAuthDataProvider.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/OAuthDataProvider.java Mon Aug  2 12:06:53 2010
@@ -19,6 +19,8 @@
 
 package org.apache.cxf.auth.oauth.provider;
 
+import java.util.Set;
+
 import net.oauth.OAuthProblemException;
 
 /**
@@ -26,9 +28,9 @@ import net.oauth.OAuthProblemException;
  */
 //todo add client credentials checking
 public interface OAuthDataProvider {
-    ClientAuthenticationInfo getClientAuthenticationInfo(String consumerKey) throws OAuthProblemException;
+    ClientAuthNInfo getClientAuthenticationInfo(String consumerKey);
 
-    RequestToken generateRequestToken(ClientAuthenticationInfo authInfo);
+    RequestToken generateRequestToken(ClientAuthNInfo authInfo);
 
     AccessToken generateAccessToken(RequestToken requestToken);
 
@@ -40,4 +42,7 @@ public interface OAuthDataProvider {
 
     RequestToken saveSecurityToken(String requestToken);
 
+    ClientAuthNInfo addNewClient(Object user, String consumerKey, ClientAuthNInfo client);
+
+    Set<ClientAuthNInfo> listAllUserClients(Object user);
 }

Modified: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/OAuthDataProviderImpl.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/OAuthDataProviderImpl.java?rev=981471&r1=981470&r2=981471&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/OAuthDataProviderImpl.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/OAuthDataProviderImpl.java Mon Aug  2 12:06:53 2010
@@ -19,48 +19,43 @@
 
 package org.apache.cxf.auth.oauth.provider;
 
+import java.util.HashSet;
+import java.util.List;
 import java.util.Map;
+import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import javax.servlet.http.HttpServletResponse;
 
-import org.apache.cxf.auth.oauth.utils.OAuthUtils;
-import org.apache.cxf.auth.oauth.validation.OAuthMessageValidator;
-
 import net.oauth.OAuth;
 import net.oauth.OAuthProblemException;
 
+import org.apache.cxf.auth.oauth.utils.OAuthUtils;
+import org.apache.cxf.auth.oauth.validation.OAuthMessageValidator;
+import org.apache.cxf.jaxrs.impl.MetadataMap;
 
 /**
  * @author Lukasz Moren
  */
 public class OAuthDataProviderImpl implements OAuthDataProvider {
 
-    private Map<String, ClientAuthenticationInfo> clientAuthInfo
-        = new ConcurrentHashMap<String, ClientAuthenticationInfo>();
+    private ConcurrentHashMap<String, ClientAuthNInfo> clientAuthInfo
+        = new ConcurrentHashMap<String, ClientAuthNInfo>();
 
-    private Map<String, Token> oauthTokens
-        = new ConcurrentHashMap<String, Token>();
+    private MetadataMap<Object, String> userRegisteredApps
+        = new MetadataMap<Object, String>();
 
-    public ClientAuthenticationInfo getClientAuthenticationInfo(String consumerKey)
-        throws OAuthProblemException {
-        ClientAuthenticationInfo authenticationInfo = clientAuthInfo.get(consumerKey);
+    private ConcurrentHashMap<String, Token> oauthTokens
+        = new ConcurrentHashMap<String, Token>();
 
-        //client credentials not found
-        if (authenticationInfo == null) {
-            OAuthProblemException problemEx = new OAuthProblemException(
-                OAuth.Problems.CONSUMER_KEY_UNKNOWN);
-            problemEx
-                .setParameter(OAuthProblemException.HTTP_STATUS_CODE, HttpServletResponse.SC_UNAUTHORIZED);
-            throw problemEx;
-        }
-        return authenticationInfo;
+    public ClientAuthNInfo getClientAuthenticationInfo(String consumerKey) {
+        return clientAuthInfo.get(consumerKey);
     }
 
-    public RequestToken generateRequestToken(ClientAuthenticationInfo clientAuthenticationInfo) {
+    public RequestToken generateRequestToken(ClientAuthNInfo clientAuthNInfo) {
         String token = OAuthUtils.generateToken();
         String tokenSecret = OAuthUtils.generateToken();
 
-        RequestToken reqToken = new RequestToken(clientAuthenticationInfo, token, tokenSecret);
+        RequestToken reqToken = new RequestToken(clientAuthNInfo, token, tokenSecret);
 
         oauthTokens.put(token, reqToken);
         return reqToken;
@@ -146,6 +141,23 @@ public class OAuthDataProviderImpl imple
         return (AccessToken)token;
     }
 
+    public ClientAuthNInfo addNewClient(Object user, String consumerKey, ClientAuthNInfo client) {
+        ClientAuthNInfo authNInfo = clientAuthInfo.putIfAbsent(consumerKey, client);
+        if (authNInfo == null) {
+            userRegisteredApps.add(user, consumerKey);
+        }
+        return authNInfo;
+    }
+
+    public Set<ClientAuthNInfo> listAllUserClients(Object user) {
+        Set<ClientAuthNInfo> apps = new HashSet<ClientAuthNInfo>();
+        List<String> appList = userRegisteredApps.get(user);
+        for (String s : appList) {
+            apps.add(clientAuthInfo.get(s));
+        }
+        return apps;
+    }
+
     private RequestToken handleTokenRejectedException() throws OAuthProblemException {
         OAuthProblemException problemEx = new OAuthProblemException(
             OAuth.Problems.TOKEN_REJECTED);
@@ -166,11 +178,7 @@ public class OAuthDataProviderImpl imple
         return OAuthUtils.generateToken();
     }
 
-    public Map<String, ClientAuthenticationInfo> getClientAuthInfo() {
-        return clientAuthInfo;
-    }
-
-    public void setClientAuthInfo(Map<String, ClientAuthenticationInfo> clientAuthInfo) {
-        this.clientAuthInfo = clientAuthInfo;
+    public void setClientAuthInfo(Map<String, ClientAuthNInfo> clientAuthInfo) {
+        this.clientAuthInfo.putAll(clientAuthInfo);
     }
 }

Modified: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/RequestToken.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/RequestToken.java?rev=981471&r1=981470&r2=981471&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/RequestToken.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/RequestToken.java Mon Aug  2 12:06:53 2010
@@ -25,9 +25,9 @@ public class RequestToken extends Token 
     protected String securityToken;
     protected String oauthVerifier;
 
-    public RequestToken(ClientAuthenticationInfo clientAuthenticationInfo, String tokenString,
+    public RequestToken(ClientAuthNInfo clientAuthNInfo, String tokenString,
                         String tokenSecret) {
-        super(clientAuthenticationInfo, tokenString, tokenSecret);
+        super(clientAuthNInfo, tokenString, tokenSecret);
     }
 
     public String getTokenSecret() {

Modified: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/Token.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/Token.java?rev=981471&r1=981470&r2=981471&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/Token.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/provider/Token.java Mon Aug  2 12:06:53 2010
@@ -25,17 +25,17 @@ public abstract class Token {
 
     protected String tokenString;
     protected String tokenSecret;
-    private ClientAuthenticationInfo clientAuthenticationInfo;
+    private ClientAuthNInfo clientAuthNInfo;
 
-    protected Token(ClientAuthenticationInfo clientAuthenticationInfo, String tokenString,
+    protected Token(ClientAuthNInfo clientAuthNInfo, String tokenString,
                     String tokenSecret) {
-        this.clientAuthenticationInfo = clientAuthenticationInfo;
+        this.clientAuthNInfo = clientAuthNInfo;
         this.tokenString = tokenString;
         this.tokenSecret = tokenSecret;
     }
 
-    public ClientAuthenticationInfo getClientAuthenticationInfo() {
-        return clientAuthenticationInfo;
+    public ClientAuthNInfo getClientAuthenticationInfo() {
+        return clientAuthNInfo;
     }
 
     public String getTokenString() {

Added: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/token/MD5TokenGenerator.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/token/MD5TokenGenerator.java?rev=981471&view=auto
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/token/MD5TokenGenerator.java (added)
+++ cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/token/MD5TokenGenerator.java Mon Aug  2 12:06:53 2010
@@ -0,0 +1,50 @@
+/**
+ * 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 org.apache.cxf.auth.oauth.token;
+
+import java.security.MessageDigest;
+import java.security.NoSuchAlgorithmException;
+
+import net.oauth.OAuthException;
+
+/**
+ * @author Lukasz Moren
+ */
+public class MD5TokenGenerator implements TokenGenerator {
+    public String generateToken(byte[] input) throws OAuthException {
+        if (input == null) {
+            throw new OAuthException("You have to pass input to Token Generator");
+        }
+
+        try {
+            MessageDigest algorithm = MessageDigest.getInstance("MD5");
+            algorithm.reset();
+            algorithm.update(input);
+            byte[] messageDigest = algorithm.digest();
+            StringBuffer hexString = new StringBuffer();
+            for (int i = 0; i < messageDigest.length; i++) {
+                hexString.append(Integer.toHexString(0xFF & messageDigest[i]));
+            }
+
+            return hexString.toString();
+        } catch (NoSuchAlgorithmException e) {
+            throw new OAuthException(e);
+        }
+    }
+}

Propchange: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/token/MD5TokenGenerator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/token/MD5TokenGenerator.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Added: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/token/TokenGenerator.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/token/TokenGenerator.java?rev=981471&view=auto
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/token/TokenGenerator.java (added)
+++ cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/token/TokenGenerator.java Mon Aug  2 12:06:53 2010
@@ -0,0 +1,28 @@
+/**
+ * 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 org.apache.cxf.auth.oauth.token;
+
+import net.oauth.OAuthException;
+
+/**
+ * @author Lukasz Moren
+ */
+public interface TokenGenerator {
+    String generateToken(byte[] input) throws OAuthException;
+}

Propchange: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/token/TokenGenerator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/token/TokenGenerator.java
------------------------------------------------------------------------------
    svn:keywords = Rev Date

Modified: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/utils/OAuthUtils.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/utils/OAuthUtils.java?rev=981471&r1=981470&r2=981471&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/utils/OAuthUtils.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/main/java/org/apache/cxf/auth/oauth/utils/OAuthUtils.java Mon Aug  2 12:06:53 2010
@@ -74,6 +74,8 @@ public final class OAuthUtils {
             try {
                 response.sendError(status);
             } catch (IOException e1) {
+                e1.printStackTrace();
+                //todo add handling
             }
         }
     }

Modified: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/test/java/org/apache/cxf/auth/oauth/endpoints/JUnit4SpringContextTests.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/test/java/org/apache/cxf/auth/oauth/endpoints/JUnit4SpringContextTests.java?rev=981471&r1=981470&r2=981471&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/test/java/org/apache/cxf/auth/oauth/endpoints/JUnit4SpringContextTests.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/test/java/org/apache/cxf/auth/oauth/endpoints/JUnit4SpringContextTests.java Mon Aug  2 12:06:53 2010
@@ -27,14 +27,14 @@ import org.springframework.context.suppo
  * @author Lukasz Moren
  */
 
-public class JUnit4SpringContextTests extends Assert {
+public abstract class JUnit4SpringContextTests extends Assert {
 
     protected ClassPathXmlApplicationContext ctx;
 
     @Before
     public void initialize() {
-        ctx = new ClassPathXmlApplicationContext(new String[]
-                {"classpath:oauth-beans.xml"});
+        String[] locations = {"classpath:oauth-beans.xml"};
+        ctx = new ClassPathXmlApplicationContext(locations);
 
     }
 

Modified: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/test/java/org/apache/cxf/auth/oauth/endpoints/OAuthResponseMessage.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/test/java/org/apache/cxf/auth/oauth/endpoints/OAuthResponseMessage.java?rev=981471&r1=981470&r2=981471&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/test/java/org/apache/cxf/auth/oauth/endpoints/OAuthResponseMessage.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/test/java/org/apache/cxf/auth/oauth/endpoints/OAuthResponseMessage.java Mon Aug  2 12:06:53 2010
@@ -1,19 +1,39 @@
-package org.apache.cxf.auth.oauth.endpoints;
+/**
+ * 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.
+ */
 
-import net.oauth.OAuth;
-import net.oauth.OAuthMessage;
+package org.apache.cxf.auth.oauth.endpoints;
 
 import java.io.IOException;
 import java.io.InputStream;
 import java.util.Collection;
 import java.util.Map;
 
+import net.oauth.OAuth;
+import net.oauth.OAuthMessage;
+
 /**
  * @author Lukasz Moren
  */
 public class OAuthResponseMessage extends OAuthMessage {
-    public OAuthResponseMessage(String method, String URL, Collection<? extends Map.Entry> parameters, InputStream inputStream) {
-        super(method, URL, parameters, inputStream);
+    public OAuthResponseMessage(String method, String url, Collection<? extends Map.Entry> parameters,
+                                InputStream inputStream) {
+        super(method, url, parameters, inputStream);
     }
 
     @Override

Modified: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/test/java/org/apache/cxf/auth/oauth/endpoints/TemporaryCredentialServiceTest.java
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/test/java/org/apache/cxf/auth/oauth/endpoints/TemporaryCredentialServiceTest.java?rev=981471&r1=981470&r2=981471&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/test/java/org/apache/cxf/auth/oauth/endpoints/TemporaryCredentialServiceTest.java (original)
+++ cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/test/java/org/apache/cxf/auth/oauth/endpoints/TemporaryCredentialServiceTest.java Mon Aug  2 12:06:53 2010
@@ -16,8 +16,6 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-
-
 package org.apache.cxf.auth.oauth.endpoints;
 
 import java.io.IOException;
@@ -28,22 +26,23 @@ import javax.servlet.http.HttpServletRes
 import javax.ws.rs.core.Response;
 import javax.ws.rs.core.UriBuilder;
 
+import net.oauth.OAuth;
+import net.oauth.OAuthProblemException;
+
 import org.apache.cxf.endpoint.Server;
 import org.apache.cxf.jaxrs.JAXRSServerFactoryBean;
 import org.apache.cxf.jaxrs.client.WebClient;
+
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import net.oauth.OAuth;
-import net.oauth.OAuthProblemException;
-
 /**
  * @author Lukasz Moren
  */
 public class TemporaryCredentialServiceTest extends JUnit4SpringContextTests {
 
-    static final String TEMPORARY_CREDENTIALS_URL = "http://localhost:9001/auth/oauth/initiate";
+    static final String TEMPORARY_CREDENTIALS_URL = "http://localhost:9000/auth/oauth/initiate";
     Server s;
 
     @Test

Modified: cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/test/resources/oauth-beans.xml
URL: http://svn.apache.org/viewvc/cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/test/resources/oauth-beans.xml?rev=981471&r1=981470&r2=981471&view=diff
==============================================================================
--- cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/test/resources/oauth-beans.xml (original)
+++ cxf/sandbox/oauth_1.0a/rt/rs/oauth/src/test/resources/oauth-beans.xml Mon Aug  2 12:06:53 2010
@@ -29,28 +29,28 @@ under the License.
     <!--<import resource="classpath:META-INF/cxf/cxf-extension-xml.xml"/>-->
 
 
-    <jaxrs:server id="oauthAuthorization" address="http://localhost:9001/auth/oauth/authorize">
-        <jaxrs:serviceBeans>
-            <ref bean="resourceOwnerAuthorizationEndpoint"/>
-        </jaxrs:serviceBeans>
-        <jaxrs:providers>
-            <ref bean="dispatchProvider"/>
-        </jaxrs:providers>
-    </jaxrs:server>
-
-    <bean id="dispatchProvider" class="org.apache.cxf.jaxrs.provider.RequestDispatcherProvider">
-        <property name="resourcePath" value="/WEB-INF/confirm.jsp"/>
-        <property name="scope" value="request"/>
-    </bean>
+    <!--<jaxrs:server id="oauthAuthorization" address="http://localhost:9001/auth/oauth/authorize">-->
+        <!--<jaxrs:serviceBeans>-->
+            <!--<ref bean="resourceOwnerAuthorizationEndpoint"/>-->
+        <!--</jaxrs:serviceBeans>-->
+        <!--<jaxrs:providers>-->
+            <!--<ref bean="dispatchProvider"/>-->
+        <!--</jaxrs:providers>-->
+    <!--</jaxrs:server>-->
+
+    <!--<bean id="dispatchProvider" class="org.apache.cxf.jaxrs.provider.RequestDispatcherProvider">-->
+        <!--<property name="resourcePath" value="/WEB-INF/confirm.jsp"/>-->
+        <!--<property name="scope" value="request"/>-->
+    <!--</bean>-->
 
-    <jaxrs:server id="oauthServer" address="http://localhost:9001/auth/oauth/">
+    <jaxrs:server id="oauthServer" address="http://localhost:9000/auth/oauth/">
         <jaxrs:serviceBeans>
             <ref bean="temporaryCredentialService"/>
         </jaxrs:serviceBeans>
     </jaxrs:server>
 
     <bean id="resourceOwnerAuthorizationEndpoint"
-          class="org.apache.cxf.auth.oauth.endpoints.ResourceOwnerAuthorizationServiceImpl">
+          class="org.apache.cxf.auth.oauth.endpoints.AuthorizationServiceImpl">
         <property name="oAuthDataProvider" ref="oauthDataProvider"/>
     </bean>
 
@@ -62,13 +62,13 @@ under the License.
     <bean id="oauthDataProvider" class="org.apache.cxf.auth.oauth.provider.OAuthDataProviderImpl">
         <property name="clientAuthInfo">
             <map key-type="java.lang.String"
-                 value-type="org.apache.cxf.auth.oauth.provider.ClientAuthenticationInfo">
+                 value-type="org.apache.cxf.auth.oauth.provider.ClientAuthNInfo">
                 <entry key="12345678" value-ref="clientAuthInfo"/>
             </map>
         </property>
     </bean>
 
-    <bean id="clientAuthInfo" class="org.apache.cxf.auth.oauth.provider.ClientAuthenticationInfoImpl">
+    <bean id="clientAuthInfo" class="org.apache.cxf.auth.oauth.provider.ClientAuthNInfoImpl">
         <constructor-arg value="12345678"/>
         <constructor-arg value="secret"/>
         <constructor-arg value="http://www.example.com/callback"/>



Mime
View raw message