oltu-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asa...@apache.org
Subject svn commit: r1482884 - in /oltu/trunk/openid-connect/client: ./ src/test/java/org/ src/test/java/org/apache/ src/test/java/org/apache/oltu/ src/test/java/org/apache/oltu/openidconnect/ src/test/java/org/apache/oltu/openidconnect/client/ src/test/java/o...
Date Wed, 15 May 2013 15:05:33 GMT
Author: asanso
Date: Wed May 15 15:05:33 2013
New Revision: 1482884

URL: http://svn.apache.org/r1482884
Log:
OLTU-37 - Implement OpenID Connect

* added simple junit test

Added:
    oltu/trunk/openid-connect/client/src/test/java/org/
    oltu/trunk/openid-connect/client/src/test/java/org/apache/
    oltu/trunk/openid-connect/client/src/test/java/org/apache/oltu/
    oltu/trunk/openid-connect/client/src/test/java/org/apache/oltu/openidconnect/
    oltu/trunk/openid-connect/client/src/test/java/org/apache/oltu/openidconnect/client/
    oltu/trunk/openid-connect/client/src/test/java/org/apache/oltu/openidconnect/client/response/
    oltu/trunk/openid-connect/client/src/test/java/org/apache/oltu/openidconnect/client/response/OpenIdConnectResponseTest.java
Modified:
    oltu/trunk/openid-connect/client/pom.xml

Modified: oltu/trunk/openid-connect/client/pom.xml
URL: http://svn.apache.org/viewvc/oltu/trunk/openid-connect/client/pom.xml?rev=1482884&r1=1482883&r2=1482884&view=diff
==============================================================================
--- oltu/trunk/openid-connect/client/pom.xml (original)
+++ oltu/trunk/openid-connect/client/pom.xml Wed May 15 15:05:33 2013
@@ -43,7 +43,13 @@
       <groupId>org.apache.oltu.oauth2</groupId>
       <artifactId>org.apache.oltu.oauth2.jwt</artifactId>
       <version>${oltu.oauth2.version}</version>
-    </dependency>
+    </dependency>    
+    <dependency>
+   		<groupId>junit-addons</groupId>
+      	<artifactId>junit-addons</artifactId>
+      	<version>1.4</version>
+      	<scope>test</scope>
+   	</dependency>   
   </dependencies>
 
   <build>

Added: oltu/trunk/openid-connect/client/src/test/java/org/apache/oltu/openidconnect/client/response/OpenIdConnectResponseTest.java
URL: http://svn.apache.org/viewvc/oltu/trunk/openid-connect/client/src/test/java/org/apache/oltu/openidconnect/client/response/OpenIdConnectResponseTest.java?rev=1482884&view=auto
==============================================================================
--- oltu/trunk/openid-connect/client/src/test/java/org/apache/oltu/openidconnect/client/response/OpenIdConnectResponseTest.java
(added)
+++ oltu/trunk/openid-connect/client/src/test/java/org/apache/oltu/openidconnect/client/response/OpenIdConnectResponseTest.java
Wed May 15 15:05:33 2013
@@ -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.oltu.openidconnect.client.response;
+import junitx.util.PrivateAccessor;
+
+import org.apache.oltu.oauth2.jwt.JWTUtils;
+import org.junit.Assert;
+import org.junit.Test;
+import org.apache.oltu.oauth2.jwt.JWT;
+
+public class OpenIdConnectResponseTest extends Assert{
+	private final String JWT = "eyJhbGciOiJSUzI1NiIsImtpZCI6ImJlMWRhMGIzNTY3YmQyNjVhMjUwOThmYmNjMmIwOWYyMTM0NWIzYTIifQ.eyJpc3MiOiJhY2NvdW50cy5nb29nbGUuY29tIiwiaWQiOiIxMDY0MjI0NTMwODI0Nzk5OTg0MjkiLCJzdWIiOiIxMDY0MjI0NTMwODI0Nzk5OTg0MjkiLCJ2ZXJpZmllZF9lbWFpbCI6InRydWUiLCJlbWFpbF92ZXJpZmllZCI6InRydWUiLCJhdWQiOiI3ODg3MzIzNzIwNzguYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLCJjaWQiOiI3ODg3MzIzNzIwNzguYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLCJhenAiOiI3ODg3MzIzNzIwNzguYXBwcy5nb29nbGV1c2VyY29udGVudC5jb20iLCJlbWFpbCI6ImFudG9uaW8uc2Fuc29AZ21haWwuY29tIiwidG9rZW5faGFzaCI6IkwySTc3Z2lCTGswUlNzMHpRMVN2Q0EiLCJhdF9oYXNoIjoiTDJJNzdnaUJMazBSU3MwelExU3ZDQSIsImlhdCI6MTM2NjcyNjMxNywiZXhwIjoxMzY2NzMwMjE3fQ.XWYi5Zj1YWAMGIml_ftoAwmvW1Y7oeybLCpzQrJVuWJpS8L8Vd2TL-RTIOEVG03VA7e0_-_frNuw7MxUgVEgh8G-Nnbk_baJ6k_3w5c1SKFamFiHHDoKLFhrt1Y8JKSuGwE02V-px4Cn0dRAQAc1IN5CU6wqCrYK0p-fv_fvy28";
+ 
+	@Test
+	public void testCheckId() throws NoSuchFieldException{
+		JWT idToken = JWTUtils.parseJWT(JWT); 		
+		OpenIdConnectResponse openIdConnectResponse= new OpenIdConnectResponse(); 
+		PrivateAccessor.setField(openIdConnectResponse, "idToken", idToken);
+		
+		assertTrue(openIdConnectResponse.checkId("accounts.google.com", "788732372078.apps.googleusercontent.com"));
+		assertFalse(openIdConnectResponse.checkId("wrongaccounts.google.com", "788732372078.apps.googleusercontent.com"));
+		assertFalse(openIdConnectResponse.checkId("wrongaccounts.google.com", "notexists788732372078.apps.googleusercontent.com"));
+	}
+}



Mime
View raw message