SES-6: first draft of SPNEGO sample webapp
This commit is contained in:
207
spring-security-kerberos-sample/pom.xml
Normal file
207
spring-security-kerberos-sample/pom.xml
Normal file
@@ -0,0 +1,207 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<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>
|
||||
<groupId>org.springframework.security.extensions</groupId>
|
||||
<artifactId>spring-security-kerberos-sample</artifactId>
|
||||
<version>1.0.0.CI-SNAPSHOT</version>
|
||||
<name>Spring Security Kerberos Sample</name>
|
||||
<packaging>war</packaging>
|
||||
|
||||
<description>Spring Security Kerberos Sample</description>
|
||||
<organization>
|
||||
<name>SpringSource, Inc</name>
|
||||
<url>http://www.springsource.com/</url>
|
||||
</organization>
|
||||
<inceptionYear>2009</inceptionYear>
|
||||
|
||||
<licenses>
|
||||
<license>
|
||||
<name>The Apache Software License, Version 2.0</name>
|
||||
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
|
||||
<distribution>repo</distribution>
|
||||
</license>
|
||||
</licenses>
|
||||
|
||||
<scm>
|
||||
<connection>scm:svn:https://src.springframework.org/svn/se-security/trunk/spring-security-kerberos</connection>
|
||||
<developerConnection>scm:svn:https://src.springframework.org/svn/se-security/trunk/spring-security-kerberos</developerConnection>
|
||||
<url>https://src.springframework.org/svn/se-security/trunk/spring-security-kerberos</url>
|
||||
</scm>
|
||||
|
||||
<issueManagement>
|
||||
<system>jira</system>
|
||||
<url>http://jira.springsource.org/browse/SES</url>
|
||||
</issueManagement>
|
||||
|
||||
<repositories>
|
||||
<repository>
|
||||
<releases>
|
||||
<enabled>false</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>true</enabled>
|
||||
</snapshots>
|
||||
<id>com.springsource.repository.maven.snapshot</id>
|
||||
<name>SpringSource Enterprise Bundle Maven Repository - SpringSource Snapshot Releases</name>
|
||||
<url>http://maven.springframework.org/snapshot</url>
|
||||
</repository>
|
||||
|
||||
<repository>
|
||||
<releases>
|
||||
<enabled>true</enabled>
|
||||
</releases>
|
||||
<snapshots>
|
||||
<enabled>false</enabled>
|
||||
</snapshots>
|
||||
<id>com.springsource.repository.maven.milestone</id>
|
||||
<name>Spring Framework Maven Milestone Releases (Maven Central Format)</name>
|
||||
<url>http://maven.springframework.org/milestone</url>
|
||||
</repository>
|
||||
</repositories>
|
||||
|
||||
<pluginRepositories>
|
||||
<pluginRepository>
|
||||
<id>com.springsource.repository.maven.milestone</id>
|
||||
<name>SpringSource Enterprise Bundle Repository - SpringSource Milestone Releases</name>
|
||||
<url>http://repository.springsource.com/maven/bundles/milestone</url>
|
||||
</pluginRepository>
|
||||
</pluginRepositories>
|
||||
|
||||
<developers>
|
||||
<developer>
|
||||
<name>Mike Wiesner</name>
|
||||
<id>mwiesner</id>
|
||||
<organization>
|
||||
SpringSource
|
||||
</organization>
|
||||
</developer>
|
||||
</developers>
|
||||
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.6</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>javax.servlet</groupId>
|
||||
<artifactId>servlet-api</artifactId>
|
||||
<version>2.4</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security.extensions</groupId>
|
||||
<artifactId>spring-security-kerberos-core</artifactId>
|
||||
<version>1.0.0.CI-SNAPSHOT</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.security</groupId>
|
||||
<artifactId>spring-security-config</artifactId>
|
||||
<version>3.0.0.M2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>log4j</groupId>
|
||||
<artifactId>log4j</artifactId>
|
||||
<version>1.2.14</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-resources-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
<configuration>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.4.2</version>
|
||||
<configuration>
|
||||
<includes>
|
||||
<include>**/*Tests.class</include>
|
||||
</includes>
|
||||
<excludes>
|
||||
<exclude>**/Abstract*</exclude>
|
||||
</excludes>
|
||||
<forkMode>once</forkMode>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>2.0.2</version>
|
||||
<configuration>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-jar-plugin</artifactId>
|
||||
<version>2.1</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>test-jar</goal>
|
||||
</goals>
|
||||
<phase>package</phase>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-assembly-plugin</artifactId>
|
||||
<version>2.1</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-install-plugin</artifactId>
|
||||
<version>2.2</version>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-deploy-plugin</artifactId>
|
||||
<version>2.3</version>
|
||||
</plugin>
|
||||
<!-- IDE -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-eclipse-plugin</artifactId>
|
||||
<version>2.5.1</version>
|
||||
<configuration>
|
||||
<downloadSources>true</downloadSources>
|
||||
<wtpversion>2.0</wtpversion>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-idea-plugin</artifactId>
|
||||
<version>2.0</version>
|
||||
<configuration>
|
||||
<downloadSources>true</downloadSources>
|
||||
<!--<downloadJavadocs>true</downloadJavadocs>-->
|
||||
<dependenciesAsLibraries>
|
||||
true
|
||||
</dependenciesAsLibraries>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<spring.version>3.0.0.M4</spring.version>
|
||||
<spring.security.version>3.0.0.M2</spring.security.version>
|
||||
</properties>
|
||||
|
||||
</project>
|
||||
@@ -0,0 +1,12 @@
|
||||
|
||||
|
||||
log4j.rootLogger=DEBUG, stdout
|
||||
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
|
||||
log4j.appender.stdout.layout.ConversionPattern=%m %n
|
||||
log4j.category.org.springframework.jdbc.datasource=DEBUG
|
||||
|
||||
# log4j.appender.stdout.layout.ConversionPattern=%d %p [%c] - <%m>%n
|
||||
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:sec="http://www.springframework.org/schema/security"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
|
||||
http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-3.0.xsd">
|
||||
|
||||
<sec:http entry-point-ref="spnegoEntryPoint" >
|
||||
<sec:intercept-url pattern="/secure/**" access="IS_AUTHENTICATED_FULLY" />
|
||||
<sec:custom-filter ref="spnegoAuthenticationProcessingFilter"
|
||||
position="BASIC_PROCESSING_FILTER" />
|
||||
</sec:http>
|
||||
|
||||
<bean id="spnegoEntryPoint"
|
||||
class="org.springframework.security.extensions.kerberos.web.SpnegoEntryPoint" />
|
||||
|
||||
<bean
|
||||
class="org.springframework.security.extensions.kerberos.web.SpnegoAuthenticationProcessingFilter" />
|
||||
|
||||
<bean id="spnegoAuthenticationProcessingFilter"
|
||||
class="org.springframework.security.extensions.kerberos.web.SpnegoAuthenticationProcessingFilter" >
|
||||
<property name="authenticationManager" ref="authenticationManager"/>
|
||||
</bean>
|
||||
|
||||
<sec:authentication-manager alias="authenticationManager" >
|
||||
<sec:authentication-provider ref="kerberosServiceAuthenticationProvider"/>
|
||||
</sec:authentication-manager>
|
||||
|
||||
<bean id="kerberosServiceAuthenticationProvider"
|
||||
class="org.springframework.security.extensions.kerberos.KerberosServiceAuthenticationProvider">
|
||||
<property name="ticketValidator">
|
||||
<bean
|
||||
class="org.springframework.security.extensions.kerberos.SunJaasKerberosTicketValidator">
|
||||
<property name="servicePrincipal" value="HTTP/mbpmike.secpod.de" />
|
||||
<property name="keyTabLocation" value="classpath:java-test.keytab" />
|
||||
</bean>
|
||||
</property>
|
||||
<property name="userDetailsService">
|
||||
<bean
|
||||
class="org.springframework.security.core.userdetails.memory.InMemoryDaoImpl">
|
||||
<property name="userProperties">
|
||||
<value>
|
||||
mike@SECPOD.DE=notUsed,ROLE_ADMIN
|
||||
</value>
|
||||
</property>
|
||||
</bean>
|
||||
</property>
|
||||
</bean>
|
||||
</beans>
|
||||
@@ -0,0 +1,35 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
|
||||
<display-name>spring-security-kerberos-sample</display-name>
|
||||
<filter>
|
||||
<filter-name>springSecurityFilterChain</filter-name>
|
||||
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
|
||||
</filter>
|
||||
|
||||
<filter-mapping>
|
||||
<filter-name>springSecurityFilterChain</filter-name>
|
||||
<url-pattern>/*</url-pattern>
|
||||
</filter-mapping>
|
||||
<context-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>/WEB-INF/security.xml</param-value>
|
||||
</context-param>
|
||||
|
||||
|
||||
<!-- Bootstraps the root web application context before servlet initialization -->
|
||||
<listener>
|
||||
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
|
||||
</listener>
|
||||
|
||||
|
||||
<context-param>
|
||||
<param-name>log4jConfigLocation</param-name>
|
||||
<param-value>classpath:/log4j.properties</param-value>
|
||||
</context-param>
|
||||
|
||||
<listener>
|
||||
<listener-class>
|
||||
org.springframework.web.util.Log4jConfigListener
|
||||
</listener-class>
|
||||
</listener>
|
||||
</web-app>
|
||||
12
spring-security-kerberos-sample/src/main/webapp/index.jsp
Normal file
12
spring-security-kerberos-sample/src/main/webapp/index.jsp
Normal file
@@ -0,0 +1,12 @@
|
||||
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
|
||||
pageEncoding="ISO-8859-1"%>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Spring Security Kerberos Sample</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>Click <a href="secure/index.jsp">here</a> to attempt SPNEGO authentication.</h1>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,12 @@
|
||||
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
|
||||
pageEncoding="ISO-8859-1"%>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
|
||||
<html>
|
||||
<head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
<title>Spring Security Kerberos Sample</title>
|
||||
</head>
|
||||
<body>
|
||||
<h1>You are the user <%= request.getRemoteUser() %>!</h1>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user