incubator-sling-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From asa...@apache.org
Subject svn commit: r1482813 - in /sling/whiteboard/asanso/openidconnect: pom.xml src/main/java/org/apache/sling/auth/openidconnect/impl/OpenIDConnectAuthenticationHandler.java src/main/java/org/apache/sling/auth/openidconnect/impl/OpenIdConnectLoginModule.java
Date Wed, 15 May 2013 13:20:19 GMT
Author: asanso
Date: Wed May 15 13:20:19 2013
New Revision: 1482813

URL: http://svn.apache.org/r1482813
Log:
SLING-2759 - Provide an OpenId Connect Authentication Handler :

* adding companion Login Module

Added:
    sling/whiteboard/asanso/openidconnect/src/main/java/org/apache/sling/auth/openidconnect/impl/OpenIdConnectLoginModule.java
Modified:
    sling/whiteboard/asanso/openidconnect/pom.xml
    sling/whiteboard/asanso/openidconnect/src/main/java/org/apache/sling/auth/openidconnect/impl/OpenIDConnectAuthenticationHandler.java

Modified: sling/whiteboard/asanso/openidconnect/pom.xml
URL: http://svn.apache.org/viewvc/sling/whiteboard/asanso/openidconnect/pom.xml?rev=1482813&r1=1482812&r2=1482813&view=diff
==============================================================================
--- sling/whiteboard/asanso/openidconnect/pom.xml (original)
+++ sling/whiteboard/asanso/openidconnect/pom.xml Wed May 15 13:20:19 2013
@@ -107,5 +107,11 @@
       		<version>0.31-SNAPSHOT</version>
     	</dependency>
     	
+    	<dependency>
+    		<groupId>org.apache.felix</groupId>
+    	    <artifactId>org.apache.felix.jaas</artifactId>
+    		<version>0.0.1-R1403198</version>
+    	</dependency>
+    	
     </dependencies>
 </project>

Modified: sling/whiteboard/asanso/openidconnect/src/main/java/org/apache/sling/auth/openidconnect/impl/OpenIDConnectAuthenticationHandler.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/asanso/openidconnect/src/main/java/org/apache/sling/auth/openidconnect/impl/OpenIDConnectAuthenticationHandler.java?rev=1482813&r1=1482812&r2=1482813&view=diff
==============================================================================
--- sling/whiteboard/asanso/openidconnect/src/main/java/org/apache/sling/auth/openidconnect/impl/OpenIDConnectAuthenticationHandler.java
(original)
+++ sling/whiteboard/asanso/openidconnect/src/main/java/org/apache/sling/auth/openidconnect/impl/OpenIDConnectAuthenticationHandler.java
Wed May 15 13:20:19 2013
@@ -18,15 +18,17 @@
  */
 package org.apache.sling.auth.openidconnect.impl;
 
+ 
 import java.io.IOException;
 import java.util.Dictionary;
-
+import javax.security.auth.spi.LoginModule;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
 import org.osgi.framework.Constants;
 import org.osgi.service.component.ComponentContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.apache.felix.jaas.LoginModuleFactory;
 import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.ConfigurationPolicy;
@@ -50,7 +52,7 @@ import org.apache.sling.commons.osgi.Osg
 	@Property(name = AuthenticationHandler.PATH_PROPERTY, value = "/"), 
 	@Property(name = Constants.SERVICE_RANKING, intValue = 50000) 
 }) 
-public class OpenIDConnectAuthenticationHandler implements AuthenticationHandler{
+public class OpenIDConnectAuthenticationHandler implements AuthenticationHandler,LoginModuleFactory{
 	
 	 /** default log */
     private final Logger log = LoggerFactory.getLogger(getClass());
@@ -65,6 +67,10 @@ public class OpenIDConnectAuthentication
     public static final String PROP_CLIENT_ID= "oauth.clientId";
     
     @Property
+    //TODO
+    public static final String PROP_CLIENT_SECRET= "oauth.client.secret";
+    
+    @Property
     public static final String PROP_REDIRECT_URI= "oauth.redirect.uri";
     
     @Property
@@ -121,7 +127,11 @@ public class OpenIDConnectAuthentication
 	public void dropCredentials(HttpServletRequest request,
 			HttpServletResponse response) throws IOException {
 		// TODO Auto-generated method stub
-		
+	}
+
+
+	public LoginModule createLoginModule() {
+		return new OpenIdConnectLoginModule(this);
 	}
 
 }

Added: sling/whiteboard/asanso/openidconnect/src/main/java/org/apache/sling/auth/openidconnect/impl/OpenIdConnectLoginModule.java
URL: http://svn.apache.org/viewvc/sling/whiteboard/asanso/openidconnect/src/main/java/org/apache/sling/auth/openidconnect/impl/OpenIdConnectLoginModule.java?rev=1482813&view=auto
==============================================================================
--- sling/whiteboard/asanso/openidconnect/src/main/java/org/apache/sling/auth/openidconnect/impl/OpenIdConnectLoginModule.java
(added)
+++ sling/whiteboard/asanso/openidconnect/src/main/java/org/apache/sling/auth/openidconnect/impl/OpenIdConnectLoginModule.java
Wed May 15 13:20:19 2013
@@ -0,0 +1,69 @@
+/*
+ * 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.sling.auth.openidconnect.impl;
+ 
+
+import java.util.Map;
+import javax.security.auth.Subject;
+import javax.security.auth.callback.CallbackHandler;
+import javax.security.auth.login.LoginException;
+import javax.security.auth.spi.LoginModule;
+
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class OpenIdConnectLoginModule implements LoginModule{
+	
+	 /** default log */
+    private final Logger log = LoggerFactory.getLogger(getClass());
+	
+	private final  OpenIDConnectAuthenticationHandler authHandler;
+
+	public OpenIdConnectLoginModule(
+			OpenIDConnectAuthenticationHandler authHandler) {
+		this.authHandler = authHandler;
+	}
+
+	public boolean abort() throws LoginException {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public boolean commit() throws LoginException {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public void initialize(Subject arg0, CallbackHandler arg1,
+			Map<String, ?> arg2, Map<String, ?> arg3) {
+		// TODO Auto-generated method stub
+		
+	}
+
+	public boolean login() throws LoginException {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+	public boolean logout() throws LoginException {
+		// TODO Auto-generated method stub
+		return false;
+	}
+
+}



Mime
View raw message