From 0cad89b645859f0ce9df06542ff58e8f3126cc23 Mon Sep 17 00:00:00 2001 From: Fernando Bellas Permuy Date: Thu, 19 Nov 2009 14:53:59 +0100 Subject: [PATCH] ItEr35S11ArquitecturaServidorItEr34S11: First version of the authentication system. It uses a basic integration with Spring Security to provide authentication to thhe Web application (Web services are not protected yet). Currently, two in-memory users have been created: "user" (with password "user") and "admin" (with password "admin"). The first one can access any page except the folder "Administration" and its contents. The last one can access any page. --- navalplanner-webapp/pom.xml | 18 +++++ ...lplanner-webapp-spring-security-config.xml | 38 +++++++++++ .../src/main/webapp/WEB-INF/web.xml | 18 ++++- .../src/main/webapp/WEB-INF/zk.xml | 13 ++++ .../main/webapp/common/layout/login_v01.zul | 22 +++++-- .../main/webapp/common/layout/template.zul | 2 +- pom.xml | 66 +++++++++++++++++++ 7 files changed, 171 insertions(+), 6 deletions(-) create mode 100644 navalplanner-webapp/src/main/resources/navalplanner-webapp-spring-security-config.xml diff --git a/navalplanner-webapp/pom.xml b/navalplanner-webapp/pom.xml index ee6bb8fba..e1f8ba15e 100644 --- a/navalplanner-webapp/pom.xml +++ b/navalplanner-webapp/pom.xml @@ -64,6 +64,24 @@ org.springframework spring-test + + + org.springframework.security + spring-security-core + + + org.springframework.security + spring-security-acl + + + org.springframework.security + spring-security-core-tiger + + + + org.aspectj + aspectjrt + org.beanshell bsh diff --git a/navalplanner-webapp/src/main/resources/navalplanner-webapp-spring-security-config.xml b/navalplanner-webapp/src/main/resources/navalplanner-webapp-spring-security-config.xml new file mode 100644 index 000000000..cae179236 --- /dev/null +++ b/navalplanner-webapp/src/main/resources/navalplanner-webapp-spring-security-config.xml @@ -0,0 +1,38 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/navalplanner-webapp/src/main/webapp/WEB-INF/web.xml b/navalplanner-webapp/src/main/webapp/WEB-INF/web.xml index f265c7170..90773ac82 100644 --- a/navalplanner-webapp/src/main/webapp/WEB-INF/web.xml +++ b/navalplanner-webapp/src/main/webapp/WEB-INF/web.xml @@ -14,7 +14,12 @@ --> contextConfigLocation - classpath*:/navalplanner-business-spring-config.xml classpath:/navalplanner-webapp-spring-config.xml classpath*:/navalplanner-override-spring-config.xml + + classpath*:/navalplanner-business-spring-config.xml + classpath:/navalplanner-webapp-spring-config.xml + classpath*:/navalplanner-override-spring-config.xml + classpath:/navalplanner-webapp-spring-security-config.xml + @@ -41,6 +46,17 @@ + + + springSecurityFilterChain + org.springframework.web.filter.DelegatingFilterProxy + + + + springSecurityFilterChain + /* + + diff --git a/navalplanner-webapp/src/main/webapp/WEB-INF/zk.xml b/navalplanner-webapp/src/main/webapp/WEB-INF/zk.xml index 0dc63a480..f6c990169 100644 --- a/navalplanner-webapp/src/main/webapp/WEB-INF/zk.xml +++ b/navalplanner-webapp/src/main/webapp/WEB-INF/zk.xml @@ -8,4 +8,17 @@ /common/event_error.zul + + + ThreadLocal Synchronization Listener + org.zkoss.zkplus.util.ThreadLocalListener + + + + ThreadLocal + + org.springframework.security.context.ThreadLocalSecurityContextHolderStrategy=contextHolder + + + diff --git a/navalplanner-webapp/src/main/webapp/common/layout/login_v01.zul b/navalplanner-webapp/src/main/webapp/common/layout/login_v01.zul index 5faefed9c..b16f6b679 100644 --- a/navalplanner-webapp/src/main/webapp/common/layout/login_v01.zul +++ b/navalplanner-webapp/src/main/webapp/common/layout/login_v01.zul @@ -24,7 +24,7 @@
- + @@ -37,6 +37,17 @@ ${i18n:_('AUTHENTICATE')} + + + + ${i18n:_('Incorrect authentication')} +
+ ]]> + + + + @@ -49,7 +60,7 @@ - + @@ -57,7 +68,7 @@ - + @@ -72,9 +83,12 @@ + + + - + diff --git a/navalplanner-webapp/src/main/webapp/common/layout/template.zul b/navalplanner-webapp/src/main/webapp/common/layout/template.zul index e1af69cff..5ab3278ed 100644 --- a/navalplanner-webapp/src/main/webapp/common/layout/template.zul +++ b/navalplanner-webapp/src/main/webapp/common/layout/template.zul @@ -37,7 +37,7 @@ ${i18n:_('user: admin')} - ${i18n:_('SIGN OUT')} + ${i18n:_('SIGN OUT')} diff --git a/pom.xml b/pom.xml index defa07a75..5d7808c69 100644 --- a/pom.xml +++ b/pom.xml @@ -261,6 +261,72 @@ spring-test 2.5.6 test +
+ + + org.springframework.security + spring-security-core + 2.0.5.RELEASE + + + org.springframework + spring-core + + + org.springframework + spring-beans + + + org.springframework + spring-context + + + org.springframework + spring-aop + + + org.springframework + spring-support + + + + + org.springframework.security + spring-security-acl + 2.0.5.RELEASE + + + org.springframework + spring-core + + + org.springframework + spring-beans + + + org.springframework + spring-context + + + org.springframework + spring-dao + + + org.springframework + spring-jdbc + + + + + org.springframework.security + spring-security-core-tiger + 2.0.5.RELEASE + + + + org.aspectj + aspectjrt + 1.5.4 net.sf.json-lib