From a9a6f8b891c393faeed592a1ac50b2b0f49ecc54 Mon Sep 17 00:00:00 2001 From: Luke Taylor Date: Sun, 18 Dec 2005 03:53:01 +0000 Subject: [PATCH] First checkin of LDAP contacts sample app. --- .../applicationContext-acegi-security.xml | 133 ++++++++++++++++++ .../src/main/webapp/ldap/WEB-INF/web.xml | 112 +++++++++++++++ .../src/main/webapp/ldap/acegilogin.jsp | 46 ++++++ .../contacts/src/main/webapp/ldap/error.html | 5 + 4 files changed, 296 insertions(+) create mode 100644 samples/contacts/src/main/webapp/ldap/WEB-INF/applicationContext-acegi-security.xml create mode 100644 samples/contacts/src/main/webapp/ldap/WEB-INF/web.xml create mode 100644 samples/contacts/src/main/webapp/ldap/acegilogin.jsp create mode 100644 samples/contacts/src/main/webapp/ldap/error.html diff --git a/samples/contacts/src/main/webapp/ldap/WEB-INF/applicationContext-acegi-security.xml b/samples/contacts/src/main/webapp/ldap/WEB-INF/applicationContext-acegi-security.xml new file mode 100644 index 0000000000..d354b43fd2 --- /dev/null +++ b/samples/contacts/src/main/webapp/ldap/WEB-INF/applicationContext-acegi-security.xml @@ -0,0 +1,133 @@ + + + + + + + + + + + + + + CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON + PATTERN_TYPE_APACHE_ANT + /**=httpSessionContextIntegrationFilter,authenticationProcessingFilter,securityEnforcementFilter + + + + + + + + + + + + + + + + cn=manager,dc=acegisecurity,dc=org + acegisecurity + ldap://monkeymachine:389/dc=acegisecurity,dc=org + + + + + + + + + + ou=groups + ou + + + + + uid={0},ou=people + + + + + + + + + + + + + + + + + + /acegilogin.jsp?login_error=1 + / + /j_acegi_security_check + + + + /acegilogin.jsp + false + + + + false + + + + + + + + + + + + + + CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON + \A/secure/super.*\Z=ROLE_WE_DONT_HAVE + \A/secure/.*\Z=ROLE_SUPERVISOR,ROLE_TELLER + + + + + + + diff --git a/samples/contacts/src/main/webapp/ldap/WEB-INF/web.xml b/samples/contacts/src/main/webapp/ldap/WEB-INF/web.xml new file mode 100644 index 0000000000..ca26575cd8 --- /dev/null +++ b/samples/contacts/src/main/webapp/ldap/WEB-INF/web.xml @@ -0,0 +1,112 @@ + + + + + + + + Contacts Sample Application + + + + contextConfigLocation + + /WEB-INF/applicationContext-acegi-security.xml + /WEB-INF/applicationContext-common-business.xml + /WEB-INF/applicationContext-common-authorization.xml + + + + + log4jConfigLocation + /WEB-INF/classes/log4j.properties + + + + Acegi Filter Chain Proxy + org.acegisecurity.util.FilterToBeanProxy + + targetClass + org.acegisecurity.util.FilterChainProxy + + + + + Acegi Filter Chain Proxy + /* + + + + + org.springframework.web.context.ContextLoaderListener + + + + org.springframework.web.util.Log4jConfigListener + + + + + org.acegisecurity.ui.session.HttpSessionEventPublisher + + + + + contacts + org.springframework.web.servlet.DispatcherServlet + 1 + + + + + remoting + org.springframework.web.servlet.DispatcherServlet + 2 + + + + contacts + *.htm + + + + remoting + /remoting/* + + + + index.jsp + + + + 403 + /error.html + + + + /spring + /WEB-INF/spring.tld + + + diff --git a/samples/contacts/src/main/webapp/ldap/acegilogin.jsp b/samples/contacts/src/main/webapp/ldap/acegilogin.jsp new file mode 100644 index 0000000000..b9ba4b1d74 --- /dev/null +++ b/samples/contacts/src/main/webapp/ldap/acegilogin.jsp @@ -0,0 +1,46 @@ +<%@ taglib prefix='c' uri='http://java.sun.com/jstl/core' %> +<%@ page import="org.acegisecurity.ui.AbstractProcessingFilter" %> +<%@ page import="org.acegisecurity.ui.webapp.AuthenticationProcessingFilter" %> +<%@ page import="org.acegisecurity.AuthenticationException" %> + + + + Login + + + +

Login

+ +

Valid users: +

+

username marissa, password koala +

username dianne, password emu +

username scott, password wombat +

username peter, password opal (user disabled) +

username bill, password wombat +

username bob, password wombat +

username jane, password wombat +

+ + <%-- 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.ACEGI_SECURITY_LAST_EXCEPTION_KEY)).getMessage() %> +
+
+ +

+ + + + + +
User:value='<%= session.getAttribute(AuthenticationProcessingFilter.ACEGI_SECURITY_LAST_USERNAME_KEY) %>'>
Password:
+ +
+ + + diff --git a/samples/contacts/src/main/webapp/ldap/error.html b/samples/contacts/src/main/webapp/ldap/error.html new file mode 100644 index 0000000000..5d461b5a25 --- /dev/null +++ b/samples/contacts/src/main/webapp/ldap/error.html @@ -0,0 +1,5 @@ + + Access denied! +

Access Denied

+ We're sorry, but you are not authorized to perform the requested operation. + \ No newline at end of file