From fe4bbe0fbf421f735928782ab75080ea3305191f Mon Sep 17 00:00:00 2001 From: Luke Taylor Date: Tue, 24 Jul 2007 17:46:43 +0000 Subject: [PATCH] SEC-514: Refactoring contacts sample into single webapp. --- samples/contacts/pom.xml | 84 +++- ...pplicationContext-common-authorization.xml | 360 +++++++++--------- .../applicationContext-common-business.xml | 73 ++-- .../webapp/{common => }/WEB-INF/.cvsignore | 0 ...applicationContext-acegi-security-cas.xml} | 104 +++-- ...pplicationContext-acegi-security-ldap.xml} | 22 +- ...pplicationContext-acegi-security-x509.xml} | 16 +- .../applicationContext-acegi-security.xml | 24 +- .../main/webapp/WEB-INF/contacts-servlet.xml | 83 ++++ .../webapp/{common => }/WEB-INF/jsp/add.jsp | 0 .../WEB-INF/jsp/addPermission.jsp | 110 +++--- .../WEB-INF/jsp/adminPermission.jsp | 56 +-- .../WEB-INF/jsp/deletePermission.jsp | 34 +- .../{common => }/WEB-INF/jsp/deleted.jsp | 0 .../webapp/{common => }/WEB-INF/jsp/hello.jsp | 4 +- .../{common => }/WEB-INF/jsp/include.jsp | 0 .../webapp/{common => }/WEB-INF/jsp/index.jsp | 0 .../{common => }/WEB-INF/remoting-servlet.xml | 4 +- .../webapp/{common => }/WEB-INF/spring.tld | 0 .../main/webapp/{ldap => }/WEB-INF/web.xml | 38 +- .../main/webapp/{filter => }/accessDenied.jsp | 32 +- .../main/webapp/{filter => }/acegilogin.jsp | 6 +- .../applicationContext-acegi-security.xml | 70 ---- .../WEB-INF/classes/resin-acegisecurity.xml | 48 --- .../src/main/webapp/ca/WEB-INF/jboss-web.xml | 7 - .../src/main/webapp/ca/WEB-INF/resin-web.xml | 13 - .../src/main/webapp/ca/WEB-INF/web.xml | 137 ------- samples/contacts/src/main/webapp/ca/login.jsp | 46 --- .../src/main/webapp/cas/WEB-INF/web.xml | 107 ------ .../src/main/webapp/{cas => }/casfailed.jsp | 6 +- .../common/WEB-INF/contacts-servlet.xml | 87 ----- .../src/main/webapp/{ldap => }/error.html | 0 .../src/main/webapp/{filter => }/exitUser.jsp | 12 +- .../src/main/webapp/filter/WEB-INF/web.xml | 107 ------ .../src/main/webapp/{common => }/index.jsp | 0 .../src/main/webapp/ldap/acegilogin.jsp | 46 --- .../main/webapp/{common => }/secure/debug.jsp | 6 +- .../main/webapp/{filter => }/switchUser.jsp | 5 +- .../src/main/webapp/x509/WEB-INF/web.xml | 99 ----- 39 files changed, 608 insertions(+), 1238 deletions(-) rename samples/contacts/src/main/webapp/{common => }/WEB-INF/.cvsignore (100%) rename samples/contacts/src/main/webapp/{cas/WEB-INF/applicationContext-acegi-security.xml => WEB-INF/applicationContext-acegi-security-cas.xml} (71%) rename samples/contacts/src/main/webapp/{ldap/WEB-INF/applicationContext-acegi-security.xml => WEB-INF/applicationContext-acegi-security-ldap.xml} (94%) rename samples/contacts/src/main/webapp/{x509/WEB-INF/applicationContext-acegi-security.xml => WEB-INF/applicationContext-acegi-security-x509.xml} (98%) rename samples/contacts/src/main/webapp/{filter => }/WEB-INF/applicationContext-acegi-security.xml (96%) create mode 100644 samples/contacts/src/main/webapp/WEB-INF/contacts-servlet.xml rename samples/contacts/src/main/webapp/{common => }/WEB-INF/jsp/add.jsp (100%) rename samples/contacts/src/main/webapp/{common => }/WEB-INF/jsp/addPermission.jsp (97%) rename samples/contacts/src/main/webapp/{common => }/WEB-INF/jsp/adminPermission.jsp (96%) rename samples/contacts/src/main/webapp/{common => }/WEB-INF/jsp/deletePermission.jsp (95%) rename samples/contacts/src/main/webapp/{common => }/WEB-INF/jsp/deleted.jsp (100%) rename samples/contacts/src/main/webapp/{common => }/WEB-INF/jsp/hello.jsp (97%) rename samples/contacts/src/main/webapp/{common => }/WEB-INF/jsp/include.jsp (100%) rename samples/contacts/src/main/webapp/{common => }/WEB-INF/jsp/index.jsp (100%) rename samples/contacts/src/main/webapp/{common => }/WEB-INF/remoting-servlet.xml (95%) rename samples/contacts/src/main/webapp/{common => }/WEB-INF/spring.tld (100%) rename samples/contacts/src/main/webapp/{ldap => }/WEB-INF/web.xml (82%) rename samples/contacts/src/main/webapp/{filter => }/accessDenied.jsp (97%) rename samples/contacts/src/main/webapp/{filter => }/acegilogin.jsp (88%) delete mode 100644 samples/contacts/src/main/webapp/ca/WEB-INF/applicationContext-acegi-security.xml delete mode 100644 samples/contacts/src/main/webapp/ca/WEB-INF/classes/resin-acegisecurity.xml delete mode 100644 samples/contacts/src/main/webapp/ca/WEB-INF/jboss-web.xml delete mode 100644 samples/contacts/src/main/webapp/ca/WEB-INF/resin-web.xml delete mode 100644 samples/contacts/src/main/webapp/ca/WEB-INF/web.xml delete mode 100644 samples/contacts/src/main/webapp/ca/login.jsp delete mode 100644 samples/contacts/src/main/webapp/cas/WEB-INF/web.xml rename samples/contacts/src/main/webapp/{cas => }/casfailed.jsp (59%) delete mode 100644 samples/contacts/src/main/webapp/common/WEB-INF/contacts-servlet.xml rename samples/contacts/src/main/webapp/{ldap => }/error.html (100%) rename samples/contacts/src/main/webapp/{filter => }/exitUser.jsp (97%) delete mode 100644 samples/contacts/src/main/webapp/filter/WEB-INF/web.xml rename samples/contacts/src/main/webapp/{common => }/index.jsp (100%) delete mode 100644 samples/contacts/src/main/webapp/ldap/acegilogin.jsp rename samples/contacts/src/main/webapp/{common => }/secure/debug.jsp (98%) rename samples/contacts/src/main/webapp/{filter => }/switchUser.jsp (90%) delete mode 100644 samples/contacts/src/main/webapp/x509/WEB-INF/web.xml diff --git a/samples/contacts/pom.xml b/samples/contacts/pom.xml index f8c1a32cc5..e345dcc9d5 100644 --- a/samples/contacts/pom.xml +++ b/samples/contacts/pom.xml @@ -13,24 +13,86 @@ war + + org.acegisecurity + acegi-security + ${project.version} + + + org.springframework + spring-webmvc + ${spring.version} + compile + javax.servlet servlet-api 2.4 provided + + net.sf.ehcache + ehcache + 1.2.4 + runtime + + + hessian + hessian + 3.0.1 + runtime + + + hsqldb + hsqldb + 1.8.0.4 + runtime + + + jstl + jstl + 1.0 + runtime + + + taglibs + standard + 1.0.6 + runtime + + + org.springframework + spring-ldap + 1.1.2 + runtime + + + org.springframework + spring-mock + ${spring.version} + test + - - - - org.apache.maven.plugins - maven-war-plugin - - src/main/webapp/filter/WEB-INF/web.xml - - - - + + + + org.apache.maven.plugins + maven-war-plugin + + + org.mortbay.jetty + maven-jetty-plugin + + /contacts + + 10 + + + + + diff --git a/samples/contacts/src/main/resources/applicationContext-common-authorization.xml b/samples/contacts/src/main/resources/applicationContext-common-authorization.xml index 28ca3d6195..05593ff3c3 100644 --- a/samples/contacts/src/main/resources/applicationContext-common-authorization.xml +++ b/samples/contacts/src/main/resources/applicationContext-common-authorization.xml @@ -11,204 +11,198 @@ - - - - classpath:/org/acegisecurity/messages - - - + + + + classpath:/org/acegisecurity/messages + + + - + - - - org.acegisecurity.acls.domain.BasePermission.ADMINISTRATION - - - org.acegisecurity.acls.domain.BasePermission.READ - - - org.acegisecurity.acls.domain.BasePermission.DELETE - + + + + + + + + + + - - + + - - - - - - - ACL_CONTACT_READ - - - - - - - - sample.contact.Contact - + + + + + + + + + + + + - - - - - - - ACL_CONTACT_DELETE - - - - - - - - sample.contact.Contact - + + + + + + + + + + + + - - - - - - - ACL_CONTACT_ADMIN - - - - - - - sample.contact.Contact - + + + + + + + + + + + - - - false - - - - - - - - - + + + + + + + + + + + + - + - - - - - - - - aclCache - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - + + + + + + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + - + + + + + - - The create, getAll, getById etc have ROLE_USER to ensure user is - authenticated (all users hold ROLE_USER in this application). + + + + + + + + - The delete and update methods don't need a ROLE_USER as they will - ensure the user is authenticated via their ACL_CONTACT_DELETE or - ACL_CONTACT_READ attribute, which also ensures the user has permission - to the Contact presented as a method argument. - --> - - - - - - - sample.contact.ContactManager.create=ROLE_USER - sample.contact.ContactManager.getAllRecipients=ROLE_USER - sample.contact.ContactManager.getAll=ROLE_USER,AFTER_ACL_COLLECTION_READ - sample.contact.ContactManager.getById=ROLE_USER,AFTER_ACL_READ - sample.contact.ContactManager.delete=ACL_CONTACT_DELETE - sample.contact.ContactManager.deletePermission=ACL_CONTACT_ADMIN - sample.contact.ContactManager.addPermission=ACL_CONTACT_ADMIN - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + sample.contact.ContactManager.create=ROLE_USER + sample.contact.ContactManager.getAllRecipients=ROLE_USER + sample.contact.ContactManager.getAll=ROLE_USER,AFTER_ACL_COLLECTION_READ + sample.contact.ContactManager.getById=ROLE_USER,AFTER_ACL_READ + sample.contact.ContactManager.delete=ACL_CONTACT_DELETE + sample.contact.ContactManager.deletePermission=ACL_CONTACT_ADMIN + sample.contact.ContactManager.addPermission=ACL_CONTACT_ADMIN + + + diff --git a/samples/contacts/src/main/resources/applicationContext-common-business.xml b/samples/contacts/src/main/resources/applicationContext-common-business.xml index 303d572dd2..082f1ff93c 100644 --- a/samples/contacts/src/main/resources/applicationContext-common-business.xml +++ b/samples/contacts/src/main/resources/applicationContext-common-business.xml @@ -11,38 +11,29 @@ - - - org.hsqldb.jdbcDriver - - - jdbc:hsqldb:mem:test - - - - sa - - - - - - + + + + + + + - + - + - - sample.contact.ContactManager.create=PROPAGATION_REQUIRED - sample.contact.ContactManager.getAllRecipients=PROPAGATION_REQUIRED,readOnly - sample.contact.ContactManager.getAll=PROPAGATION_REQUIRED,readOnly - sample.contact.ContactManager.getById=PROPAGATION_REQUIRED,readOnly - sample.contact.ContactManager.delete=PROPAGATION_REQUIRED - sample.contact.ContactManager.deletePermission=PROPAGATION_REQUIRED - sample.contact.ContactManager.addPermission=PROPAGATION_REQUIRED - + + sample.contact.ContactManager.create=PROPAGATION_REQUIRED + sample.contact.ContactManager.getAllRecipients=PROPAGATION_REQUIRED,readOnly + sample.contact.ContactManager.getAll=PROPAGATION_REQUIRED,readOnly + sample.contact.ContactManager.getById=PROPAGATION_REQUIRED,readOnly + sample.contact.ContactManager.delete=PROPAGATION_REQUIRED + sample.contact.ContactManager.deletePermission=PROPAGATION_REQUIRED + sample.contact.ContactManager.addPermission=PROPAGATION_REQUIRED + @@ -51,25 +42,25 @@ - - - - - sample.contact.ContactManager - - - - - - - + + + + + + + + - - + + + + + + diff --git a/samples/contacts/src/main/webapp/common/WEB-INF/.cvsignore b/samples/contacts/src/main/webapp/WEB-INF/.cvsignore similarity index 100% rename from samples/contacts/src/main/webapp/common/WEB-INF/.cvsignore rename to samples/contacts/src/main/webapp/WEB-INF/.cvsignore diff --git a/samples/contacts/src/main/webapp/cas/WEB-INF/applicationContext-acegi-security.xml b/samples/contacts/src/main/webapp/WEB-INF/applicationContext-acegi-security-cas.xml similarity index 71% rename from samples/contacts/src/main/webapp/cas/WEB-INF/applicationContext-acegi-security.xml rename to samples/contacts/src/main/webapp/WEB-INF/applicationContext-acegi-security-cas.xml index eaabf39df2..a3522f576e 100644 --- a/samples/contacts/src/main/webapp/cas/WEB-INF/applicationContext-acegi-security.xml +++ b/samples/contacts/src/main/webapp/WEB-INF/applicationContext-acegi-security-cas.xml @@ -7,48 +7,47 @@ - - Only used by "cas" artifact. - - - $Id$ + - $Id: applicationContext-acegi-security.xml 1409 2006-04-26 23:36:03Z benalex $ --> - - - - CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON - PATTERN_TYPE_APACHE_ANT - /**=channelProcessingFilter,httpSessionContextIntegrationFilter,logoutFilter,casProcessingFilter,basicProcessingFilter,exceptionTranslationFilter,filterInvocationInterceptor - - - + + + + CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON + PATTERN_TYPE_APACHE_ANT + /**=channelProcessingFilter,httpSessionContextIntegrationFilter,logoutFilter,casProcessingFilter,basicProcessingFilter,exceptionTranslationFilter,filterInvocationInterceptor + + + - + - - - - - - - + + + + + + + - - - + + + - - - - + + + + - - Contacts Realm - + + Contacts Realm + - - + @@ -59,23 +58,19 @@ - https://localhost:8443/cas/proxyValidate - https://localhost:8443/contacts-cas/casProxy/receptor + + - - - - - - - - ticketCache - - - + + + + + + + @@ -84,12 +79,11 @@ - - + - https://localhost:8443/contacts-cas/j_acegi_cas_security_check - false + + @@ -104,7 +98,7 @@ - + @@ -112,7 +106,7 @@ CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON \A/secure/.*\Z=REQUIRES_SECURE_CHANNEL - \A/j_acegi_cas_security_check.*\Z=REQUIRES_SECURE_CHANNEL + \A/j_acegi_cas_security_check.*\Z=REQUIRES_SECURE_CHANNEL \A.*\Z=REQUIRES_INSECURE_CHANNEL @@ -171,24 +165,24 @@ - + @@ -37,9 +37,9 @@ - - cn=manager,dc=acegisecurity,dc=org - acegisecurity + + + @@ -115,28 +115,28 @@ - + + --> diff --git a/samples/contacts/src/main/webapp/x509/WEB-INF/applicationContext-acegi-security.xml b/samples/contacts/src/main/webapp/WEB-INF/applicationContext-acegi-security-x509.xml similarity index 98% rename from samples/contacts/src/main/webapp/x509/WEB-INF/applicationContext-acegi-security.xml rename to samples/contacts/src/main/webapp/WEB-INF/applicationContext-acegi-security-x509.xml index 8fb89e398b..54c9e3ec86 100644 --- a/samples/contacts/src/main/webapp/x509/WEB-INF/applicationContext-acegi-security.xml +++ b/samples/contacts/src/main/webapp/WEB-INF/applicationContext-acegi-security-x509.xml @@ -7,7 +7,7 @@ - - Only used by "x509" artifact. - - - $Id$ + - $Id: applicationContext-acegi-security.xml 1409 2006-04-26 23:36:03Z benalex $ --> @@ -87,7 +87,7 @@ - + @@ -148,24 +148,24 @@ - + @@ -21,7 +21,7 @@ CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON PATTERN_TYPE_APACHE_ANT - /**=httpSessionContextIntegrationFilter,logoutFilter,authenticationProcessingFilter,basicProcessingFilter,securityContextHolderAwareRequestFilter,rememberMeProcessingFilter,anonymousProcessingFilter,exceptionTranslationFilter,filterInvocationInterceptor,switchUserProcessingFilter + /**=httpSessionContextIntegrationFilter,logoutFilter,authenticationProcessingFilter,basicProcessingFilter,securityContextHolderAwareRequestFilter,rememberMeProcessingFilter,anonymousProcessingFilter,switchUserProcessingFilter,exceptionTranslationFilter,filterInvocationInterceptor @@ -46,12 +46,12 @@ - + - + @@ -98,11 +98,11 @@ springRocks - + springRocks - + @@ -112,7 +112,7 @@ - + @@ -199,7 +199,7 @@ - @@ -207,6 +207,6 @@ /j_acegi_switch_user /j_acegi_exit_user /acegi-security-sample-contacts-filter/secure/index.htm - + diff --git a/samples/contacts/src/main/webapp/WEB-INF/contacts-servlet.xml b/samples/contacts/src/main/webapp/WEB-INF/contacts-servlet.xml new file mode 100644 index 0000000000..3fe00d250c --- /dev/null +++ b/samples/contacts/src/main/webapp/WEB-INF/contacts-servlet.xml @@ -0,0 +1,83 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + publicIndexController + secureAddForm + secureIndexController + secureDeleteController + adminPermissionController + deletePermissionController + addPermissionForm + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/samples/contacts/src/main/webapp/common/WEB-INF/jsp/add.jsp b/samples/contacts/src/main/webapp/WEB-INF/jsp/add.jsp similarity index 100% rename from samples/contacts/src/main/webapp/common/WEB-INF/jsp/add.jsp rename to samples/contacts/src/main/webapp/WEB-INF/jsp/add.jsp diff --git a/samples/contacts/src/main/webapp/common/WEB-INF/jsp/addPermission.jsp b/samples/contacts/src/main/webapp/WEB-INF/jsp/addPermission.jsp similarity index 97% rename from samples/contacts/src/main/webapp/common/WEB-INF/jsp/addPermission.jsp rename to samples/contacts/src/main/webapp/WEB-INF/jsp/addPermission.jsp index 96f7d76120..52c05365ec 100644 --- a/samples/contacts/src/main/webapp/common/WEB-INF/jsp/addPermission.jsp +++ b/samples/contacts/src/main/webapp/WEB-INF/jsp/addPermission.jsp @@ -1,55 +1,55 @@ -<%@ include file="/WEB-INF/jsp/include.jsp" %> - -Add Permission - -

Add Permission

-
- - - - - - - - - - - - - - - - - - - -
Contact:
Recipient: - - - -
Permission: - - - -
-
- - Please fix all errors! - -

- -
-

-">Admin Permission ">Manage - - +<%@ include file="/WEB-INF/jsp/include.jsp" %> + +Add Permission + +

Add Permission

+
+ + + + + + + + + + + + + + + + + + + +
Contact:
Recipient: + + + +
Permission: + + + +
+
+ + Please fix all errors! + +

+ +
+

+">Admin Permission ">Manage + + diff --git a/samples/contacts/src/main/webapp/common/WEB-INF/jsp/adminPermission.jsp b/samples/contacts/src/main/webapp/WEB-INF/jsp/adminPermission.jsp similarity index 96% rename from samples/contacts/src/main/webapp/common/WEB-INF/jsp/adminPermission.jsp rename to samples/contacts/src/main/webapp/WEB-INF/jsp/adminPermission.jsp index c6aa83063d..9f799b0ee2 100644 --- a/samples/contacts/src/main/webapp/common/WEB-INF/jsp/adminPermission.jsp +++ b/samples/contacts/src/main/webapp/WEB-INF/jsp/adminPermission.jsp @@ -1,28 +1,28 @@ -<%@ include file="/WEB-INF/jsp/include.jsp" %> - - -Administer Permissions - -

Administer Permissions

-

- - - -

- - - - - - - -
- - - - - ">Del -
-

">Add Permission ">Manage - - +<%@ include file="/WEB-INF/jsp/include.jsp" %> + + +Administer Permissions + +

Administer Permissions

+

+ + + +

+ + + + + + + +
+ + + + + ">Del +
+

">Add Permission ">Manage + + diff --git a/samples/contacts/src/main/webapp/common/WEB-INF/jsp/deletePermission.jsp b/samples/contacts/src/main/webapp/WEB-INF/jsp/deletePermission.jsp similarity index 95% rename from samples/contacts/src/main/webapp/common/WEB-INF/jsp/deletePermission.jsp rename to samples/contacts/src/main/webapp/WEB-INF/jsp/deletePermission.jsp index 9fdb393ace..85a71a2b6b 100644 --- a/samples/contacts/src/main/webapp/common/WEB-INF/jsp/deletePermission.jsp +++ b/samples/contacts/src/main/webapp/WEB-INF/jsp/deletePermission.jsp @@ -1,20 +1,20 @@ -<%@ include file="/WEB-INF/jsp/include.jsp" %> - - -Permission Deleted - -

Permission Deleted

-

- - - -

- - - +<%@ include file="/WEB-INF/jsp/include.jsp" %> + + +Permission Deleted + +

Permission Deleted

+

+ + + +

+ + + -

">Manage - - +

">Manage + + diff --git a/samples/contacts/src/main/webapp/common/WEB-INF/jsp/deleted.jsp b/samples/contacts/src/main/webapp/WEB-INF/jsp/deleted.jsp similarity index 100% rename from samples/contacts/src/main/webapp/common/WEB-INF/jsp/deleted.jsp rename to samples/contacts/src/main/webapp/WEB-INF/jsp/deleted.jsp diff --git a/samples/contacts/src/main/webapp/common/WEB-INF/jsp/hello.jsp b/samples/contacts/src/main/webapp/WEB-INF/jsp/hello.jsp similarity index 97% rename from samples/contacts/src/main/webapp/common/WEB-INF/jsp/hello.jsp rename to samples/contacts/src/main/webapp/WEB-INF/jsp/hello.jsp index 2a40c618f9..4f018bcc74 100644 --- a/samples/contacts/src/main/webapp/common/WEB-INF/jsp/hello.jsp +++ b/samples/contacts/src/main/webapp/WEB-INF/jsp/hello.jsp @@ -15,13 +15,13 @@ layer bean has a number of secured (protected) and public (unprotected) methods.

  • Web request security. The /secure URI path is protected - by Acegi Security from principals not holding the + by Acegi Security from principals not holding the ROLE_USER granted authority.
  • Security unaware application objects. None of the objects are aware of the security being implemented by Acegi Security. *
  • Security taglib usage. All of the JSPs use Acegi Security's taglib to evaluate security information. *
  • -
  • Fully declarative security. Every capability is configured in +
  • Fully declarative security. Every capability is configured in the application context using standard Acegi Security classes. *
  • Database-sourced security data. All of the user, role and ACL information is obtained from an in-memory JDBC-compliant database.
  • diff --git a/samples/contacts/src/main/webapp/common/WEB-INF/jsp/include.jsp b/samples/contacts/src/main/webapp/WEB-INF/jsp/include.jsp similarity index 100% rename from samples/contacts/src/main/webapp/common/WEB-INF/jsp/include.jsp rename to samples/contacts/src/main/webapp/WEB-INF/jsp/include.jsp diff --git a/samples/contacts/src/main/webapp/common/WEB-INF/jsp/index.jsp b/samples/contacts/src/main/webapp/WEB-INF/jsp/index.jsp similarity index 100% rename from samples/contacts/src/main/webapp/common/WEB-INF/jsp/index.jsp rename to samples/contacts/src/main/webapp/WEB-INF/jsp/index.jsp diff --git a/samples/contacts/src/main/webapp/common/WEB-INF/remoting-servlet.xml b/samples/contacts/src/main/webapp/WEB-INF/remoting-servlet.xml similarity index 95% rename from samples/contacts/src/main/webapp/common/WEB-INF/remoting-servlet.xml rename to samples/contacts/src/main/webapp/WEB-INF/remoting-servlet.xml index cdc2ec7171..647b9b6a23 100644 --- a/samples/contacts/src/main/webapp/common/WEB-INF/remoting-servlet.xml +++ b/samples/contacts/src/main/webapp/WEB-INF/remoting-servlet.xml @@ -3,12 +3,12 @@ - Contacts Sample Application - + + + + edu.yale.its.tp.cas.proxyUrl + http://localhost:8433/cas/proxy + + + + log4jConfigLocation /WEB-INF/classes/log4j.properties + Acegi Filter Chain Proxy org.acegisecurity.util.FilterToBeanProxy @@ -44,10 +58,10 @@ Acegi Filter Chain Proxy /* - + @@ -62,11 +76,11 @@ The HttpSessionEventPublisher will publish HttpSessionCreatedEvent and HttpSessionDestroyedEvent to the WebApplicationContext - --> + --> org.acegisecurity.ui.session.HttpSessionEventPublisher - + @@ -89,7 +103,7 @@ contacts *.htm - + remoting /remoting/* @@ -98,13 +112,13 @@ index.jsp - + 403 /error.html - + /spring /WEB-INF/spring.tld diff --git a/samples/contacts/src/main/webapp/filter/accessDenied.jsp b/samples/contacts/src/main/webapp/accessDenied.jsp similarity index 97% rename from samples/contacts/src/main/webapp/filter/accessDenied.jsp rename to samples/contacts/src/main/webapp/accessDenied.jsp index 816d4526f8..c35b77d8ce 100644 --- a/samples/contacts/src/main/webapp/filter/accessDenied.jsp +++ b/samples/contacts/src/main/webapp/accessDenied.jsp @@ -1,16 +1,16 @@ -<%@ page import="org.acegisecurity.context.SecurityContextHolder" %> -<%@ page import="org.acegisecurity.Authentication" %> -<%@ page import="org.acegisecurity.ui.AccessDeniedHandlerImpl" %> - -

    Sorry, access is denied

    - - -

    -<%= request.getAttribute(AccessDeniedHandlerImpl.ACEGI_SECURITY_ACCESS_DENIED_EXCEPTION_KEY)%> - -

    - -<% Authentication auth = SecurityContextHolder.getContext().getAuthentication(); - if (auth != null) { %> - Authentication object as a String: <%= auth.toString() %>

    -<% } %> +<%@ page import="org.acegisecurity.context.SecurityContextHolder" %> +<%@ page import="org.acegisecurity.Authentication" %> +<%@ page import="org.acegisecurity.ui.AccessDeniedHandlerImpl" %> + +

    Sorry, access is denied

    + + +

    +<%= request.getAttribute(AccessDeniedHandlerImpl.ACEGI_SECURITY_ACCESS_DENIED_EXCEPTION_KEY)%> + +

    + +<% Authentication auth = SecurityContextHolder.getContext().getAuthentication(); + if (auth != null) { %> + Authentication object as a String: <%= auth.toString() %>

    +<% } %> diff --git a/samples/contacts/src/main/webapp/filter/acegilogin.jsp b/samples/contacts/src/main/webapp/acegilogin.jsp similarity index 88% rename from samples/contacts/src/main/webapp/filter/acegilogin.jsp rename to samples/contacts/src/main/webapp/acegilogin.jsp index f3d67e6e74..87e2298cad 100644 --- a/samples/contacts/src/main/webapp/filter/acegilogin.jsp +++ b/samples/contacts/src/main/webapp/acegilogin.jsp @@ -21,8 +21,8 @@

    username bob, password wombat

    username jane, password wombat

    - - <%-- this form-login-page form is also used as the + + <%-- this form-login-page form is also used as the form-error-page to ask for a login again. --%> @@ -34,7 +34,7 @@

    - + diff --git a/samples/contacts/src/main/webapp/ca/WEB-INF/applicationContext-acegi-security.xml b/samples/contacts/src/main/webapp/ca/WEB-INF/applicationContext-acegi-security.xml deleted file mode 100644 index f99f5e48fd..0000000000 --- a/samples/contacts/src/main/webapp/ca/WEB-INF/applicationContext-acegi-security.xml +++ /dev/null @@ -1,70 +0,0 @@ - - - - - - - - - - - - - - CONVERT_URL_TO_LOWERCASE_BEFORE_COMPARISON - PATTERN_TYPE_APACHE_ANT - /**=httpSessionContextIntegrationFilter,httpRequestIntegrationFilter,logoutFilter - - - - - - - - - - - - - - - - - my_password - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/samples/contacts/src/main/webapp/ca/WEB-INF/classes/resin-acegisecurity.xml b/samples/contacts/src/main/webapp/ca/WEB-INF/classes/resin-acegisecurity.xml deleted file mode 100644 index a2606f4377..0000000000 --- a/samples/contacts/src/main/webapp/ca/WEB-INF/classes/resin-acegisecurity.xml +++ /dev/null @@ -1,48 +0,0 @@ - - - - - - - - - - - - - marissa=koala,ROLE_TELLER,ROLE_SUPERVISOR - dianne=emu,ROLE_TELLER - scott=wombat,ROLE_TELLER - peter=opal,disabled,ROLE_TELLER - - - - - - - - true - - - - - - - - - - - - diff --git a/samples/contacts/src/main/webapp/ca/WEB-INF/jboss-web.xml b/samples/contacts/src/main/webapp/ca/WEB-INF/jboss-web.xml deleted file mode 100644 index 042053ac6c..0000000000 --- a/samples/contacts/src/main/webapp/ca/WEB-INF/jboss-web.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - java:/jaas/SpringPoweredRealm - diff --git a/samples/contacts/src/main/webapp/ca/WEB-INF/resin-web.xml b/samples/contacts/src/main/webapp/ca/WEB-INF/resin-web.xml deleted file mode 100644 index 4dd24b2559..0000000000 --- a/samples/contacts/src/main/webapp/ca/WEB-INF/resin-web.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - org.acegisecurity.adapters.resin.ResinAcegiAuthenticator - - resin-acegisecurity.xml - my_password - - - diff --git a/samples/contacts/src/main/webapp/ca/WEB-INF/web.xml b/samples/contacts/src/main/webapp/ca/WEB-INF/web.xml deleted file mode 100644 index 79e93e20b2..0000000000 --- a/samples/contacts/src/main/webapp/ca/WEB-INF/web.xml +++ /dev/null @@ -1,137 +0,0 @@ - - - - - - - - Contacts Sample Application - - - - contextConfigLocation - - /WEB-INF/applicationContext-acegi-security.xml - classpath:applicationContext-common-business.xml - classpath: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 - - - - - contacts - org.springframework.web.servlet.DispatcherServlet - 1 - - - - - remoting - org.springframework.web.servlet.DispatcherServlet - 2 - - - - contacts - *.htm - - - - remoting - /remoting/* - - - - index.jsp - - - - /spring - /WEB-INF/spring.tld - - - - Secured Area Security Constraint - - Secured Area - /secure/* - - - ROLE_USER - ROLE_SUPERVISOR - - - - - - - - - FORM - Spring Powered Realm - - /login.jsp - /login.jsp?login_error=1 - - - - - - ROLE_SUPERVISOR - - - ROLE_USER - - - diff --git a/samples/contacts/src/main/webapp/ca/login.jsp b/samples/contacts/src/main/webapp/ca/login.jsp deleted file mode 100644 index 5a0e4b0ad0..0000000000 --- a/samples/contacts/src/main/webapp/ca/login.jsp +++ /dev/null @@ -1,46 +0,0 @@ -<%@ taglib prefix='c' uri='http://java.sun.com/jstl/core' %> - - - 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. - - - - -

    User:value='>
    User:value='<%= session.getAttribute(AuthenticationProcessingFilter.ACEGI_SECURITY_LAST_USERNAME_KEY) %>'>
    Password:
    Don't ask for my password for two weeks
    - - - - - -
    User:
    Password:
    - - - -
    - - - diff --git a/samples/contacts/src/main/webapp/cas/WEB-INF/web.xml b/samples/contacts/src/main/webapp/cas/WEB-INF/web.xml deleted file mode 100644 index f7e7d25eb6..0000000000 --- a/samples/contacts/src/main/webapp/cas/WEB-INF/web.xml +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - - - Contacts Sample Application - - - - contextConfigLocation - - /WEB-INF/applicationContext-acegi-security.xml - classpath:applicationContext-common-business.xml - classpath:applicationContext-common-authorization.xml - - - - - log4jConfigLocation - /WEB-INF/classes/log4j.properties - - - - - edu.yale.its.tp.cas.proxyUrl - http://localhost:8433/cas/proxy - - - - 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 - - - - - contacts - org.springframework.web.servlet.DispatcherServlet - 1 - - - - - remoting - org.springframework.web.servlet.DispatcherServlet - 2 - - - - contacts - *.htm - - - - remoting - /remoting/* - - - - index.jsp - - - - /spring - /WEB-INF/spring.tld - - - diff --git a/samples/contacts/src/main/webapp/cas/casfailed.jsp b/samples/contacts/src/main/webapp/casfailed.jsp similarity index 59% rename from samples/contacts/src/main/webapp/cas/casfailed.jsp rename to samples/contacts/src/main/webapp/casfailed.jsp index 8079e66687..67223a9d58 100644 --- a/samples/contacts/src/main/webapp/cas/casfailed.jsp +++ b/samples/contacts/src/main/webapp/casfailed.jsp @@ -1,6 +1,6 @@ <%@ taglib prefix='c' uri='http://java.sun.com/jstl/core' %> -<%@ page import="net.sf.acegisecurity.ui.AbstractProcessingFilter" %> -<%@ page import="net.sf.acegisecurity.AuthenticationException" %> +<%@ page import="org.acegisecurity.ui.AbstractProcessingFilter" %> +<%@ page import="org.acegisecurity.AuthenticationException" %> @@ -12,7 +12,7 @@ Your CAS credentials were rejected.

    - Reason: <%= ((AuthenticationException) session.getAttribute(AbstractProcessingFilter.ACEGI_SECURITY_LAST_EXCEPTION_KEY)).getMessage() %> + Reason: <%= ((AuthenticationException) session.getAttribute(org.acegisecurity.ui.AbstractProcessingFilter.ACEGI_SECURITY_LAST_EXCEPTION_KEY)).getMessage() %>
    diff --git a/samples/contacts/src/main/webapp/common/WEB-INF/contacts-servlet.xml b/samples/contacts/src/main/webapp/common/WEB-INF/contacts-servlet.xml deleted file mode 100644 index 3176dec545..0000000000 --- a/samples/contacts/src/main/webapp/common/WEB-INF/contacts-servlet.xml +++ /dev/null @@ -1,87 +0,0 @@ - - - - - - - - - - - messages - - - - - - - - - - - - - - - - - - - - - - - - - - - - publicIndexController - secureAddForm - secureIndexController - secureDeleteController - adminPermissionController - deletePermissionController - addPermissionForm - - - - - - - - - - true - webContact - sample.contact.WebContact - - add - index.htm - - - - - - - true - addPermission - sample.contact.AddPermission - - addPermission - index.htm - - - - - - - /WEB-INF/jsp/ - .jsp - - - diff --git a/samples/contacts/src/main/webapp/ldap/error.html b/samples/contacts/src/main/webapp/error.html similarity index 100% rename from samples/contacts/src/main/webapp/ldap/error.html rename to samples/contacts/src/main/webapp/error.html diff --git a/samples/contacts/src/main/webapp/filter/exitUser.jsp b/samples/contacts/src/main/webapp/exitUser.jsp similarity index 97% rename from samples/contacts/src/main/webapp/filter/exitUser.jsp rename to samples/contacts/src/main/webapp/exitUser.jsp index baae57491c..7ea7f7903b 100644 --- a/samples/contacts/src/main/webapp/filter/exitUser.jsp +++ b/samples/contacts/src/main/webapp/exitUser.jsp @@ -25,16 +25,16 @@
    Current User: - <% + <% Authentication auth = SecurityContextHolder.getContext().getAuthentication(); if (auth != null) { %> - + <%= auth.getPrincipal().toString() %> - + <% } %> - - - + + +
    diff --git a/samples/contacts/src/main/webapp/filter/WEB-INF/web.xml b/samples/contacts/src/main/webapp/filter/WEB-INF/web.xml deleted file mode 100644 index cd05943446..0000000000 --- a/samples/contacts/src/main/webapp/filter/WEB-INF/web.xml +++ /dev/null @@ -1,107 +0,0 @@ - - - - - - - - Contacts Sample Application - - - - contextConfigLocation - - /WEB-INF/applicationContext-acegi-security.xml - classpath:applicationContext-common-business.xml - classpath: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 - - - - /spring - /WEB-INF/spring.tld - - - diff --git a/samples/contacts/src/main/webapp/common/index.jsp b/samples/contacts/src/main/webapp/index.jsp similarity index 100% rename from samples/contacts/src/main/webapp/common/index.jsp rename to samples/contacts/src/main/webapp/index.jsp diff --git a/samples/contacts/src/main/webapp/ldap/acegilogin.jsp b/samples/contacts/src/main/webapp/ldap/acegilogin.jsp deleted file mode 100644 index 3f842e7340..0000000000 --- a/samples/contacts/src/main/webapp/ldap/acegilogin.jsp +++ /dev/null @@ -1,46 +0,0 @@ -<%@ 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='>
    Password:
    - -
    - - - diff --git a/samples/contacts/src/main/webapp/common/secure/debug.jsp b/samples/contacts/src/main/webapp/secure/debug.jsp similarity index 98% rename from samples/contacts/src/main/webapp/common/secure/debug.jsp rename to samples/contacts/src/main/webapp/secure/debug.jsp index 2d59a4d6ab..1a136eca34 100644 --- a/samples/contacts/src/main/webapp/common/secure/debug.jsp +++ b/samples/contacts/src/main/webapp/secure/debug.jsp @@ -3,12 +3,12 @@ <%@ page import="org.acegisecurity.GrantedAuthority" %> <%@ page import="org.acegisecurity.adapters.AuthByAdapter" %> -<% +<% Authentication auth = SecurityContextHolder.getContext().getAuthentication(); if (auth != null) { %> Authentication object is of type: <%= auth.getClass().getName() %>

    Authentication object as a String: <%= auth.toString() %>

    - + Authentication object holds the following granted authorities:

    <% GrantedAuthority[] granted = auth.getAuthorities(); for (int i = 0; i < granted.length; i++) { %> @@ -20,7 +20,7 @@ <% } else { %>
    SUCCESS! Your web filters appear to be properly configured!
    <% } - + } else { %> Authentication object is null.
    This is an error and your Acegi Security application will not operate properly until corrected.

    diff --git a/samples/contacts/src/main/webapp/filter/switchUser.jsp b/samples/contacts/src/main/webapp/switchUser.jsp similarity index 90% rename from samples/contacts/src/main/webapp/filter/switchUser.jsp rename to samples/contacts/src/main/webapp/switchUser.jsp index caa7f1292c..b3978c770b 100644 --- a/samples/contacts/src/main/webapp/filter/switchUser.jsp +++ b/samples/contacts/src/main/webapp/switchUser.jsp @@ -1,6 +1,5 @@ <%@ 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" %> @@ -20,8 +19,8 @@

    username bob, password wombat

    username jane, password wombat

    - - <%-- this form-login-page form is also used as the + + <%-- this form-login-page form is also used as the form-error-page to ask for a login again. --%> diff --git a/samples/contacts/src/main/webapp/x509/WEB-INF/web.xml b/samples/contacts/src/main/webapp/x509/WEB-INF/web.xml deleted file mode 100644 index 2482b7db94..0000000000 --- a/samples/contacts/src/main/webapp/x509/WEB-INF/web.xml +++ /dev/null @@ -1,99 +0,0 @@ - - - - - - - - Contacts Sample Application - - - - contextConfigLocation - - /WEB-INF/applicationContext-acegi-security.xml - classpath:applicationContext-common-business.xml - classpath:applicationContext-common-authorization.xml - - - - - - Acegi Filter Chain Proxy - org.acegisecurity.util.FilterToBeanProxy - - targetClass - org.acegisecurity.util.FilterChainProxy - - - - - Acegi Filter Chain Proxy - /* - - - - - org.springframework.web.context.ContextLoaderListener - - - - - contacts - org.springframework.web.servlet.DispatcherServlet - 1 - - - - - remoting - org.springframework.web.servlet.DispatcherServlet - 2 - - - - contacts - *.htm - - - - remoting - /remoting/* - - - - index.jsp - - - - /spring - /WEB-INF/spring.tld - - -