incubator-amber-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tomm...@apache.org
Subject svn commit: r1211140 - in /incubator/amber/trunk/oauth-2.0: oauth2-authzserver/src/main/java/org/apache/amber/oauth2/as/request/ oauth2-authzserver/src/main/java/org/apache/amber/oauth2/as/validator/ oauth2-authzserver/src/test/java/org/apache/amber/oa...
Date Tue, 06 Dec 2011 21:02:55 GMT
Author: tommaso
Date: Tue Dec  6 21:02:54 2011
New Revision: 1211140

URL: http://svn.apache.org/viewvc?rev=1211140&view=rev
Log:
[AMBER-31] - applied patch from Antonio Sanso

Modified:
    incubator/amber/trunk/oauth-2.0/oauth2-authzserver/src/main/java/org/apache/amber/oauth2/as/request/OAuthAuthzRequest.java
    incubator/amber/trunk/oauth-2.0/oauth2-authzserver/src/main/java/org/apache/amber/oauth2/as/validator/CodeTokenValidator.java
    incubator/amber/trunk/oauth-2.0/oauth2-authzserver/src/test/java/org/apache/amber/oauth2/as/validator/CodeTokenValidatorTest.java
    incubator/amber/trunk/oauth-2.0/oauth2-integration-tests/src/test/java/org/apache/amber/oauth2/integration/endpoints/AuthzEndpoint.java

Modified: incubator/amber/trunk/oauth-2.0/oauth2-authzserver/src/main/java/org/apache/amber/oauth2/as/request/OAuthAuthzRequest.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-authzserver/src/main/java/org/apache/amber/oauth2/as/request/OAuthAuthzRequest.java?rev=1211140&r1=1211139&r2=1211140&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-authzserver/src/main/java/org/apache/amber/oauth2/as/request/OAuthAuthzRequest.java
(original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-authzserver/src/main/java/org/apache/amber/oauth2/as/request/OAuthAuthzRequest.java
Tue Dec  6 21:02:54 2011
@@ -23,7 +23,6 @@ package org.apache.amber.oauth2.as.reque
 
 import javax.servlet.http.HttpServletRequest;
 
-import org.apache.amber.oauth2.as.validator.CodeTokenValidator;
 import org.apache.amber.oauth2.as.validator.CodeValidator;
 import org.apache.amber.oauth2.as.validator.TokenValidator;
 import org.apache.amber.oauth2.common.OAuth;
@@ -49,7 +48,6 @@ public class OAuthAuthzRequest extends O
         //end user authorization validators
         validators.put(ResponseType.CODE.toString(), CodeValidator.class);
         validators.put(ResponseType.TOKEN.toString(), TokenValidator.class);
-        validators.put(ResponseType.CODE_AND_TOKEN.toString(), CodeTokenValidator.class);
         String requestTypeValue = getParam(OAuth.OAUTH_RESPONSE_TYPE);
         if (OAuthUtils.isEmpty(requestTypeValue)) {
             throw OAuthUtils.handleOAuthProblemException("Missing response_type parameter
value");

Modified: incubator/amber/trunk/oauth-2.0/oauth2-authzserver/src/main/java/org/apache/amber/oauth2/as/validator/CodeTokenValidator.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-authzserver/src/main/java/org/apache/amber/oauth2/as/validator/CodeTokenValidator.java?rev=1211140&r1=1211139&r2=1211140&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-authzserver/src/main/java/org/apache/amber/oauth2/as/validator/CodeTokenValidator.java
(original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-authzserver/src/main/java/org/apache/amber/oauth2/as/validator/CodeTokenValidator.java
Tue Dec  6 21:02:54 2011
@@ -1,58 +0,0 @@
-/**
- *       Copyright 2010 Newcastle University
- *
- *          http://research.ncl.ac.uk/smart/
- *
- * 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.amber.oauth2.as.validator;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.amber.oauth2.common.OAuth;
-import org.apache.amber.oauth2.common.error.OAuthError;
-import org.apache.amber.oauth2.common.exception.OAuthProblemException;
-import org.apache.amber.oauth2.common.validators.AbstractValidator;
-
-
-/**
- * @author Maciej Machulak (m.p.machulak@ncl.ac.uk)
- * @author Lukasz Moren (lukasz.moren@ncl.ac.uk)
- * @author Aad van Moorsel (aad.vanmoorsel@ncl.ac.uk)
- */
-public class CodeTokenValidator extends AbstractValidator {
-
-    public CodeTokenValidator() {
-        requiredParams.add(OAuth.OAUTH_RESPONSE_TYPE);
-        requiredParams.add(OAuth.OAUTH_CLIENT_ID);
-        requiredParams.add(OAuth.OAUTH_REDIRECT_URI);
-    }
-
-    @Override
-    public void validateMethod(HttpServletRequest request) throws OAuthProblemException {
-        String method = request.getMethod();
-        if (!method.equals(OAuth.HttpMethod.GET) && !method.equals(OAuth.HttpMethod.POST))
{
-            throw OAuthProblemException.error(OAuthError.CodeResponse.INVALID_REQUEST)
-                .description("Method not correct.");
-        }
-    }
-
-    @Override
-    public void validateContentType(HttpServletRequest request) throws OAuthProblemException
{
-    }
-}
-

Modified: incubator/amber/trunk/oauth-2.0/oauth2-authzserver/src/test/java/org/apache/amber/oauth2/as/validator/CodeTokenValidatorTest.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-authzserver/src/test/java/org/apache/amber/oauth2/as/validator/CodeTokenValidatorTest.java?rev=1211140&r1=1211139&r2=1211140&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-authzserver/src/test/java/org/apache/amber/oauth2/as/validator/CodeTokenValidatorTest.java
(original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-authzserver/src/test/java/org/apache/amber/oauth2/as/validator/CodeTokenValidatorTest.java
Tue Dec  6 21:02:54 2011
@@ -1,84 +0,0 @@
-/**
- *       Copyright 2010 Newcastle University
- *
- *          http://research.ncl.ac.uk/smart/
- *
- * 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.amber.oauth2.as.validator;
-
-import javax.servlet.http.HttpServletRequest;
-
-import org.apache.amber.oauth2.as.validator.CodeTokenValidator;
-import org.apache.amber.oauth2.common.OAuth;
-import org.junit.Assert;
-import org.junit.Test;
-import org.apache.amber.oauth2.common.exception.OAuthProblemException;
-
-import static org.easymock.EasyMock.createStrictMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.reset;
-import static org.easymock.EasyMock.verify;
-
-
-/**
- * @author Maciej Machulak (m.p.machulak@ncl.ac.uk)
- * @author Lukasz Moren (lukasz.moren@ncl.ac.uk)
- * @author Aad van Moorsel (aad.vanmoorsel@ncl.ac.uk)
- */
-public class CodeTokenValidatorTest {
-    @Test
-    public void testValidateMethod() throws Exception {
-        HttpServletRequest request = createStrictMock(HttpServletRequest.class);
-        expect(request.getMethod()).andStubReturn(OAuth.HttpMethod.GET);
-
-        replay(request);
-        CodeTokenValidator validator = new CodeTokenValidator();
-        validator.validateMethod(request);
-
-        verify(request);
-
-        reset(request);
-
-        request = createStrictMock(HttpServletRequest.class);
-        expect(request.getMethod()).andStubReturn(OAuth.HttpMethod.POST);
-
-        replay(request);
-        validator = new CodeTokenValidator();
-        validator.validateMethod(request);
-
-        verify(request);
-
-        reset(request);
-
-        request = createStrictMock(HttpServletRequest.class);
-        expect(request.getMethod()).andStubReturn(OAuth.HttpMethod.DELETE);
-
-        replay(request);
-        validator = new CodeTokenValidator();
-
-        try {
-            validator.validateMethod(request);
-            Assert.fail("Expected validation exception");
-        } catch (OAuthProblemException e) {
-            //ok, expected
-        }
-
-        verify(request);
-    }
-}

Modified: incubator/amber/trunk/oauth-2.0/oauth2-integration-tests/src/test/java/org/apache/amber/oauth2/integration/endpoints/AuthzEndpoint.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-integration-tests/src/test/java/org/apache/amber/oauth2/integration/endpoints/AuthzEndpoint.java?rev=1211140&r1=1211139&r2=1211140&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-integration-tests/src/test/java/org/apache/amber/oauth2/integration/endpoints/AuthzEndpoint.java
(original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-integration-tests/src/test/java/org/apache/amber/oauth2/integration/endpoints/AuthzEndpoint.java
Tue Dec  6 21:02:54 2011
@@ -67,12 +67,10 @@ public class AuthzEndpoint {
             OAuthASResponse.OAuthAuthorizationResponseBuilder builder = OAuthASResponse
                 .authorizationResponse(HttpServletResponse.SC_FOUND);
 
-            if (responseType.equals(ResponseType.CODE.toString()) || responseType
-                .equals(ResponseType.CODE_AND_TOKEN.toString())) {
+            if (responseType.equals(ResponseType.CODE.toString())) {
                 builder.setCode(oauthIssuerImpl.authorizationCode());
             }
-            if (responseType.equals(ResponseType.TOKEN.toString()) || responseType
-                .equals(ResponseType.CODE_AND_TOKEN.toString())) {
+            if (responseType.equals(ResponseType.TOKEN.toString())) {
                 builder.setAccessToken(oauthIssuerImpl.accessToken());
                 builder.setExpiresIn(String.valueOf(3600));
             }



Mime
View raw message