diff --git a/samples/openid/pom.xml b/samples/openid/pom.xml new file mode 100644 index 0000000000..1e10c0fa60 --- /dev/null +++ b/samples/openid/pom.xml @@ -0,0 +1,110 @@ + + 4.0.0 + + org.springframework.security + spring-security-samples + 2.0-SNAPSHOT + + org.springframework.security + spring-security-samples-openid + Spring Security - openid sample + war + + + org.springframework.security + spring-security-core + ${project.version} + + + org.springframework.security + spring-security-openid + ${project.version} + + + org.springframework + spring-web + + + org.springframework + spring-webmvc + ${spring.version} + + + org.springframework + spring-jdbc + runtime + + + org.springframework + spring-aop + runtime + + + javax.servlet + jstl + 1.2 + runtime + + + taglibs + standard + 1.0.6 + runtime + + + jaxen + jaxen + 1.1.1 + true + + + org.apache.directory.server + apacheds-core + 1.0.2 + compile + true + + + org.apache.directory.server + apacheds-server-jndi + 1.0.2 + compile + true + + + org.slf4j + slf4j-log4j12 + 1.4.3 + runtime + true + + + org.springframework.ldap + spring-ldap + 1.2.1 + true + + + + + + + org.apache.maven.plugins + maven-compiler-plugin + + 1.5 + 1.5 + + + + org.mortbay.jetty + maven-jetty-plugin + 6.1.7 + + /openid + + + + + + \ No newline at end of file diff --git a/samples/openid/src/main/java/Dummy.java b/samples/openid/src/main/java/Dummy.java new file mode 100644 index 0000000000..ec965f0f10 --- /dev/null +++ b/samples/openid/src/main/java/Dummy.java @@ -0,0 +1,6 @@ +/** + * @author Luke Taylor + * @version $Id$ + */ +public class Dummy { +} diff --git a/samples/openid/src/main/webapp/WEB-INF/applicationContext-security.xml b/samples/openid/src/main/webapp/WEB-INF/applicationContext-security.xml new file mode 100644 index 0000000000..9823cd6a45 --- /dev/null +++ b/samples/openid/src/main/webapp/WEB-INF/applicationContext-security.xml @@ -0,0 +1,49 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/samples/openid/src/main/webapp/WEB-INF/classes/log4j.properties b/samples/openid/src/main/webapp/WEB-INF/classes/log4j.properties new file mode 100644 index 0000000000..5a78fdb39c --- /dev/null +++ b/samples/openid/src/main/webapp/WEB-INF/classes/log4j.properties @@ -0,0 +1,20 @@ +# Global logging configuration +log4j.rootLogger=INFO, stdout, fileout + +log4j.logger.org.springframework.security=DEBUG, stdout, fileout + +# Console output... +log4j.appender.stdout=org.apache.log4j.ConsoleAppender +log4j.appender.stdout.layout=org.apache.log4j.PatternLayout +log4j.appender.stdout.layout.conversionPattern=[%p,%c{1},%t] %m%n + +# Rolling log file output... +log4j.appender.fileout=org.apache.log4j.RollingFileAppender +log4j.appender.fileout.File=spring-security-preauth.log +#log4j.appender.fileout.File=${webapp.root}/WEB-INF/log4j.log +log4j.appender.fileout.MaxFileSize=1024KB +log4j.appender.fileout.MaxBackupIndex=1 +log4j.appender.fileout.layout=org.apache.log4j.PatternLayout +log4j.appender.fileout.layout.conversionPattern=%d{ABSOLUTE} %5p %c{1},%t:%L - %m%n + + diff --git a/samples/openid/src/main/webapp/WEB-INF/web.xml b/samples/openid/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 0000000000..b203f61cfc --- /dev/null +++ b/samples/openid/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,61 @@ + + + + + + Spring Security Preauthentication Demo Application + + + + contextConfigLocation + + /WEB-INF/applicationContext-security.xml + + + + + log4jConfigLocation + /WEB-INF/classes/log4j.properties + + + + springSecurityFilterChain + org.springframework.web.filter.DelegatingFilterProxy + + + + springSecurityFilterChain + /* + + + + + org.springframework.web.context.ContextLoaderListener + + + + org.springframework.web.util.Log4jConfigListener + + + + + org.springframework.security.ui.session.HttpSessionEventPublisher + + + diff --git a/samples/openid/src/main/webapp/index.jsp b/samples/openid/src/main/webapp/index.jsp new file mode 100644 index 0000000000..9f056599b6 --- /dev/null +++ b/samples/openid/src/main/webapp/index.jsp @@ -0,0 +1,11 @@ + + +

Home Page

+

Anyone can view this page.

+ +

Your principal object is....: <%= request.getUserPrincipal() %>

+ +

Secure page

+

Extremely secure page

+ + \ No newline at end of file diff --git a/samples/openid/src/main/webapp/openidlogin.jsp b/samples/openid/src/main/webapp/openidlogin.jsp new file mode 100644 index 0000000000..30aed80c8c --- /dev/null +++ b/samples/openid/src/main/webapp/openidlogin.jsp @@ -0,0 +1,35 @@ +<%@ taglib prefix='c' uri='http://java.sun.com/jsp/jstl/core' %> +<%@ page import="org.springframework.security.ui.AbstractProcessingFilter" %> +<%@ page import="org.springframework.security.ui.webapp.AuthenticationProcessingFilter" %> +<%@ page import="org.springframework.security.AuthenticationException" %> + + + + Open ID Login + + + +

Login

+ + <%-- this form-login-page form is also used as the + form-error-page to ask for a login again. + --%> + + + Your login attempt was not successful, try again.

+ Reason: <%= ((AuthenticationException) session.getAttribute(AbstractProcessingFilter.SPRING_SECURITY_LAST_EXCEPTION_KEY)).getMessage() %> +
+
+ +
+ + + + + +
Open ID Identity:value='<%= session.getAttribute(AuthenticationProcessingFilter.SPRING_SECURITY_LAST_USERNAME_KEY) %>'>
+ +
+ + + \ No newline at end of file diff --git a/samples/openid/src/main/webapp/secure/extreme/index.jsp b/samples/openid/src/main/webapp/secure/extreme/index.jsp new file mode 100644 index 0000000000..93f7a17cfc --- /dev/null +++ b/samples/openid/src/main/webapp/secure/extreme/index.jsp @@ -0,0 +1,15 @@ +<%@ taglib prefix="authz" uri="http://www.springframework.org/security/tags" %> + + + +

VERY Secure Page

+This is a protected page. You can only see me if you are a supervisor. + + + You have "ROLE_SUPERVISOR" (this text is surrounded by <authz:authorize> tags). + + +

Home +

Logout + + \ No newline at end of file diff --git a/samples/openid/src/main/webapp/secure/index.jsp b/samples/openid/src/main/webapp/secure/index.jsp new file mode 100644 index 0000000000..b774c40ed8 --- /dev/null +++ b/samples/openid/src/main/webapp/secure/index.jsp @@ -0,0 +1,15 @@ + + +

Secure Page

+This is a protected page. You can get to me if you've been remembered, +or if you've authenticated this session.

+ +<%if (request.isUserInRole("ROLE_SUPERVISOR")) { %> + You are a supervisor! You can therefore see the extremely secure page.

+<% } %> + + +

Home +

Logout + + \ No newline at end of file