Author: [email protected] Date: Fri Aug 5 13:38:52 2011 New Revision: 1268 Log:
Added: sandbox/ivol/ntlm/ sandbox/ivol/ntlm/org/ sandbox/ivol/ntlm/org/amdatu/ sandbox/ivol/ntlm/org/amdatu/auth/ sandbox/ivol/ntlm/org/amdatu/auth/ntlm/ sandbox/ivol/ntlm/org/amdatu/auth/ntlm/osgi/ sandbox/ivol/ntlm/pom.xml sandbox/ivol/ntlm/src/ sandbox/ivol/ntlm/src/main/ sandbox/ivol/ntlm/src/main/java/ sandbox/ivol/ntlm/src/main/java/org/ sandbox/ivol/ntlm/src/main/java/org/amdatu/ sandbox/ivol/ntlm/src/main/java/org/amdatu/auth/ sandbox/ivol/ntlm/src/main/java/org/amdatu/auth/ntlm/ sandbox/ivol/ntlm/src/main/java/org/amdatu/auth/ntlm/osgi/ sandbox/ivol/ntlm/src/main/java/org/amdatu/auth/ntlm/osgi/Activator.java sandbox/ivol/ntlm/src/main/java/org/amdatu/auth/ntlm/service/ sandbox/ivol/ntlm/src/main/java/org/amdatu/auth/ntlm/service/WebResourceProvider.java sandbox/ivol/ntlm/src/main/resources/ sandbox/ivol/ntlm/src/main/resources/jsp/ sandbox/ivol/ntlm/src/main/resources/jsp/ntlm.jsp Added: sandbox/ivol/ntlm/pom.xml ============================================================================== --- (empty file) +++ sandbox/ivol/ntlm/pom.xml Fri Aug 5 13:38:52 2011 @@ -0,0 +1,77 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (c) 2010, 2011 The Amdatu Foundation + + Licensed 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.verning permissions and limitations + under the License. +--> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + <parent> + <groupId>org.amdatu.auth</groupId> + <artifactId>org.amdatu.auth</artifactId> + <version>0.2.0-SNAPSHOT</version> + </parent> + <artifactId>org.amdatu.auth.ntlm</artifactId> + <packaging>bundle</packaging> + <name>Amdatu Auth - NTLM</name> + <description>Provides NTLM authentication.</description> + + <dependencies> + <dependency> + <groupId>org.amdatu.web</groupId> + <artifactId>org.amdatu.web.dispatcher</artifactId> + <type>bundle</type> + </dependency> + <dependency> + <groupId>org.amdatu.web</groupId> + <artifactId>org.amdatu.web.httpcontext</artifactId> + <type>bundle</type> + </dependency> + <dependency> + <groupId>org.amdatu.web</groupId> + <artifactId>org.amdatu.web.jsp</artifactId> + <type>bundle</type> + </dependency> + <dependency> + <groupId>org.amdatu.web</groupId> + <artifactId>org.amdatu.web.resource</artifactId> + <type>bundle</type> + </dependency> + <dependency> + <groupId>org.samba.jcifs</groupId> + <artifactId>jcifs</artifactId> + <version>1.3.16</version> + <scope>compile</scope> + </dependency> + </dependencies> + + <build> + <plugins> + <plugin> + <groupId>org.apache.felix</groupId> + <artifactId>maven-bundle-plugin</artifactId> + <configuration> + <instructions> + <Bundle-Activator>org.amdatu.auth.ntlm.osgi.Activator</Bundle-Activator> + <Bundle-SymbolicName>org.amdatu.auth.ntlm</Bundle-SymbolicName> + <Embed-Dependency>*;scope=compile</Embed-Dependency> + <Export-Package></Export-Package> + </instructions> + </configuration> + </plugin> + + </plugins> + </build> +</project> Added: sandbox/ivol/ntlm/src/main/java/org/amdatu/auth/ntlm/osgi/Activator.java ============================================================================== --- (empty file) +++ sandbox/ivol/ntlm/src/main/java/org/amdatu/auth/ntlm/osgi/Activator.java Fri Aug 5 13:38:52 2011 @@ -0,0 +1,73 @@ +/* + * Copyright (c) 2010, 2011 The Amdatu Foundation + * + * Licensed 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.amdatu.auth.ntlm.osgi; + +import java.util.Dictionary; +import java.util.Hashtable; + +import org.amdatu.auth.ntlm.service.WebResourceProvider; +import org.amdatu.web.dispatcher.DispatcherService; +import org.amdatu.web.httpcontext.ResourceProvider; +import org.amdatu.web.jsp.JspSupport; +import org.amdatu.web.resource.ResourceSupport; +import org.apache.felix.dm.DependencyActivatorBase; +import org.apache.felix.dm.DependencyManager; +import org.osgi.framework.BundleContext; +import org.osgi.service.log.LogService; + +/** + * This is the activator for the NTLM authentication bundle. + * + * @author ivol + */ +public class Activator extends DependencyActivatorBase { + /** + * URL alias hosting the resources of this Twitter example. + */ + public static final String ALIAS = "/ntlm"; + + /** + * URL alias hosting the JSPs of this Twitter example. + */ + public static final String JSP_ALIAS = ALIAS + "/jsp"; + + /** + * URL alias hosting the statics of this Twitter example. + */ + public static final String RES_ALIAS = ALIAS + "/static"; + + /** + * Context id of the Example HTTP Context. + */ + public static final String CONTEXTID = "amdatu-ntlm"; + + @Override + public void init(final BundleContext context, final DependencyManager manager) throws Exception { + // Register the tweet gadget + Dictionary<String, Object> properties = new Hashtable<String, Object>(); + properties.put(DispatcherService.CONTEXT_ID_KEY, CONTEXTID); + properties.put(JspSupport.JSP_ALIAS_KEY, JSP_ALIAS); + properties.put(ResourceSupport.RESOURCE_ALIAS_KEY, RES_ALIAS); + + manager.add(createComponent().setInterface(ResourceProvider.class.getName(), properties) + .setImplementation(WebResourceProvider.class) + .add(createServiceDependency().setService(LogService.class).setRequired(true))); + } + + @Override + public void destroy(final BundleContext context, final DependencyManager manager) throws Exception { + } +} Added: sandbox/ivol/ntlm/src/main/java/org/amdatu/auth/ntlm/service/WebResourceProvider.java ============================================================================== --- (empty file) +++ sandbox/ivol/ntlm/src/main/java/org/amdatu/auth/ntlm/service/WebResourceProvider.java Fri Aug 5 13:38:52 2011 @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2010, 2011 The Amdatu Foundation + * + * Licensed 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.amdatu.auth.ntlm.service; + +import java.net.URL; + +import org.amdatu.auth.ntlm.osgi.Activator; +import org.amdatu.web.httpcontext.ResourceProvider; +import org.osgi.framework.BundleContext; +import org.osgi.service.log.LogService; + +/** + * This class provides the web resources. + */ +public class WebResourceProvider implements ResourceProvider { + // Service dependencies, injected by the Felix dependency manager + private volatile LogService m_logService; + private volatile BundleContext m_bundleContext; + + public URL getResource(final String name) { + final String pathPrefix = Activator.ALIAS + "/"; + if (name != null && name.startsWith(pathPrefix)) { + return m_bundleContext.getBundle().getResource(name.substring(pathPrefix.length())); + } + return null; + } +} Added: sandbox/ivol/ntlm/src/main/resources/jsp/ntlm.jsp ============================================================================== --- (empty file) +++ sandbox/ivol/ntlm/src/main/resources/jsp/ntlm.jsp Fri Aug 5 13:38:52 2011 @@ -0,0 +1,22 @@ +<%-- + Copyright (c) 2010, 2011 The Amdatu Foundation + + Licensed 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.verning permissions and limitations + under the License. +--%> + +<%@ page language="java" session="false" buffer="none" %> +<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %> + +<h1>NTLM authentication</h1> +Welcome ...! \ No newline at end of file _______________________________________________ Amdatu-commits mailing list [email protected] http://lists.amdatu.org/mailman/listinfo/amdatu-commits
