oltu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From st...@apache.org
Subject svn commit: r1483105 - /oltu/trunk/oauth-2.0/integration-tests/src/test/java/org/apache/oltu/oauth2/integration/EndUserAuthorizationTest.java
Date Wed, 15 May 2013 21:49:41 GMT
Author: stein
Date: Wed May 15 21:49:41 2013
New Revision: 1483105

URL: http://svn.apache.org/r1483105
Log:
OLTU-3 Update integration tests to include the state parameter

Modified:
    oltu/trunk/oauth-2.0/integration-tests/src/test/java/org/apache/oltu/oauth2/integration/EndUserAuthorizationTest.java

Modified: oltu/trunk/oauth-2.0/integration-tests/src/test/java/org/apache/oltu/oauth2/integration/EndUserAuthorizationTest.java
URL: http://svn.apache.org/viewvc/oltu/trunk/oauth-2.0/integration-tests/src/test/java/org/apache/oltu/oauth2/integration/EndUserAuthorizationTest.java?rev=1483105&r1=1483104&r2=1483105&view=diff
==============================================================================
--- oltu/trunk/oauth-2.0/integration-tests/src/test/java/org/apache/oltu/oauth2/integration/EndUserAuthorizationTest.java
(original)
+++ oltu/trunk/oauth-2.0/integration-tests/src/test/java/org/apache/oltu/oauth2/integration/EndUserAuthorizationTest.java
Wed May 15 21:49:41 2013
@@ -58,7 +58,6 @@ public class EndUserAuthorizationTest ex
             .buildQueryMessage();
 
         Common.doRequest(request);
-
     }
 
     @Test
@@ -71,8 +70,12 @@ public class EndUserAuthorizationTest ex
             .setState(Common.STATE)
             .buildQueryMessage();
 
-        Common.doRequest(request);
+        HttpURLConnection c = Common.doRequest(request);
+        String queryString = c.getURL().toURI().getQuery();
+        Map<String, Object> map = OAuthUtils.decodeForm(queryString);
 
+        assertNotNull(map.get(OAuth.OAUTH_CODE));
+        assertEquals(Common.STATE, map.get(OAuth.OAUTH_STATE));
     }
 
     @Test
@@ -82,6 +85,7 @@ public class EndUserAuthorizationTest ex
             .setClientId(Common.CLIENT_ID)
             .setRedirectURI(Common.REDIRECT_URL + "2")
             .setResponseType(ResponseType.TOKEN.toString())
+            .setState(Common.STATE)
             .buildQueryMessage();
 
         HttpURLConnection c = Common.doRequest(request);
@@ -90,7 +94,7 @@ public class EndUserAuthorizationTest ex
 
         assertNotNull(map.get(OAuth.OAUTH_EXPIRES_IN));
         assertNotNull(map.get(OAuth.OAUTH_ACCESS_TOKEN));
-
+        assertEquals(Common.STATE, map.get(OAuth.OAUTH_STATE));
     }
 
     @GET



Mime
View raw message