oltu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lmo...@apache.org
Subject svn commit: r1199094 - in /incubator/amber/trunk/oauth-2.0/oauth2-resourceserver/src: main/java/org/apache/amber/oauth2/rs/request/OAuthAccessResourceRequest.java test/java/org/apache/amber/oauth2/rs/OAuthAccessResourceRequestTest.java
Date Tue, 08 Nov 2011 03:36:41 GMT
Author: lmoren
Date: Tue Nov  8 03:36:40 2011
New Revision: 1199094

URL: http://svn.apache.org/viewvc?rev=1199094&view=rev
Log:
[AMBER-43] Missing OAuth parameter is ambiguous for a resource request

Modified:
    incubator/amber/trunk/oauth-2.0/oauth2-resourceserver/src/main/java/org/apache/amber/oauth2/rs/request/OAuthAccessResourceRequest.java
    incubator/amber/trunk/oauth-2.0/oauth2-resourceserver/src/test/java/org/apache/amber/oauth2/rs/OAuthAccessResourceRequestTest.java

Modified: incubator/amber/trunk/oauth-2.0/oauth2-resourceserver/src/main/java/org/apache/amber/oauth2/rs/request/OAuthAccessResourceRequest.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-resourceserver/src/main/java/org/apache/amber/oauth2/rs/request/OAuthAccessResourceRequest.java?rev=1199094&r1=1199093&r2=1199094&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-resourceserver/src/main/java/org/apache/amber/oauth2/rs/request/OAuthAccessResourceRequest.java
(original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-resourceserver/src/main/java/org/apache/amber/oauth2/rs/request/OAuthAccessResourceRequest.java
Tue Nov  8 03:36:40 2011
@@ -89,6 +89,7 @@ public class OAuthAccessResourceRequest 
         int foundValidStyles = 0;
         boolean lackAuthInfo = false;
         OAuthProblemException ex = null;
+        String lackAuthReason = "OAuth parameters were not found";
         for (ParameterStyle style : parameterStyles) {
             try {
 
@@ -103,6 +104,7 @@ public class OAuthAccessResourceRequest 
                 //request lacks any authentication information?
                 if (OAuthUtils.isEmpty(e.getError())) {
                     lackAuthInfo = true;
+                    lackAuthReason = e.getDescription();
                 } else {
                     ex = OAuthProblemException.error(e.getError(), e.getDescription());
                 }
@@ -119,7 +121,7 @@ public class OAuthAccessResourceRequest 
         }
 
         if (foundValidStyles == 0 && lackAuthInfo) {
-            throw OAuthProblemException.error(null, "OAuth parameters were not found");
+            throw OAuthProblemException.error(null, lackAuthReason);
         }
 
         if (foundValidStyles == 0) {

Modified: incubator/amber/trunk/oauth-2.0/oauth2-resourceserver/src/test/java/org/apache/amber/oauth2/rs/OAuthAccessResourceRequestTest.java
URL: http://svn.apache.org/viewvc/incubator/amber/trunk/oauth-2.0/oauth2-resourceserver/src/test/java/org/apache/amber/oauth2/rs/OAuthAccessResourceRequestTest.java?rev=1199094&r1=1199093&r2=1199094&view=diff
==============================================================================
--- incubator/amber/trunk/oauth-2.0/oauth2-resourceserver/src/test/java/org/apache/amber/oauth2/rs/OAuthAccessResourceRequestTest.java
(original)
+++ incubator/amber/trunk/oauth-2.0/oauth2-resourceserver/src/test/java/org/apache/amber/oauth2/rs/OAuthAccessResourceRequestTest.java
Tue Nov  8 03:36:40 2011
@@ -62,7 +62,7 @@ public class OAuthAccessResourceRequestT
             new OAuthAccessResourceRequest(request);
             fail("Exception expected");
         } catch (OAuthProblemException e) {
-            Assert.assertEquals("OAuth parameters were not found", e.getDescription());
+            Assert.assertEquals("Missing authorization header.", e.getDescription());
         }
 
         verify(request);
@@ -82,7 +82,7 @@ public class OAuthAccessResourceRequestT
             new OAuthAccessResourceRequest(request);
             fail("Exception expected");
         } catch (OAuthProblemException e) {
-            Assert.assertEquals("OAuth parameters were not found", e.getDescription());
+            Assert.assertEquals("Incorrect authorization method.", e.getDescription());
         }
         verify(request);
     }
@@ -98,7 +98,7 @@ public class OAuthAccessResourceRequestT
 
         try {
             new OAuthAccessResourceRequest(request);
-            fail("Exception expeted");
+            fail("Exception expected");
         } catch (OAuthProblemException e) {
             Assert
                 .assertTrue(
@@ -223,7 +223,7 @@ public class OAuthAccessResourceRequestT
 
         try {
             new OAuthAccessResourceRequest(request, ParameterStyle.BODY, ParameterStyle.HEADER);
-            fail("Exception expeted");
+            fail("Exception expected");
         } catch (OAuthProblemException e) {
             Assert
                 .assertTrue(
@@ -404,7 +404,7 @@ public class OAuthAccessResourceRequestT
             new OAuthAccessResourceRequest(request);
             fail("Exception expected");
         } catch (OAuthProblemException e) {
-            Assert.assertEquals("OAuth parameters were not found", e.getDescription());
+            Assert.assertEquals("Missing authorization header.", e.getDescription());
         }
         verify(request);
     }
@@ -425,7 +425,7 @@ public class OAuthAccessResourceRequestT
             new OAuthAccessResourceRequest(request, ParameterStyle.BODY);
             fail("Exception expected");
         } catch (OAuthProblemException e) {
-            Assert.assertEquals("OAuth parameters were not found", e.getDescription());
+            Assert.assertEquals("Missing OAuth token.", e.getDescription());
         }
         verify(request);
     }



Mime
View raw message