You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shiro.apache.org by jh...@apache.org on 2009/03/02 04:08:16 UTC

svn commit: r749156 [2/2] - in /incubator/jsecurity/import/trunk: ./ samples/quickstart/ samples/spring-hibernate/ samples/spring-hibernate/WEB-INF/ samples/spring-hibernate/src/org/jsecurity/samples/sprhib/dao/ samples/spring-hibernate/src/org/jsecuri...

Added: incubator/jsecurity/import/trunk/samples/spring-hibernate/src/org/jsecurity/samples/sprhib/web/SecurityController.java
URL: http://svn.apache.org/viewvc/incubator/jsecurity/import/trunk/samples/spring-hibernate/src/org/jsecurity/samples/sprhib/web/SecurityController.java?rev=749156&view=auto
==============================================================================
--- incubator/jsecurity/import/trunk/samples/spring-hibernate/src/org/jsecurity/samples/sprhib/web/SecurityController.java (added)
+++ incubator/jsecurity/import/trunk/samples/spring-hibernate/src/org/jsecurity/samples/sprhib/web/SecurityController.java Mon Mar  2 03:08:14 2009
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jsecurity.samples.sprhib.web;
+
+import org.jsecurity.SecurityUtils;
+import org.jsecurity.authc.AuthenticationException;
+import org.jsecurity.authc.UsernamePasswordToken;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+/**
+ * Web MVC controller that handles security-related web requests, such as login and logout.
+ */
+@Controller
+public class SecurityController {
+
+    private LoginValidator loginValidator = new LoginValidator();
+
+    @RequestMapping(value="/login",method= RequestMethod.GET)
+    public String showLoginForm(Model model, @ModelAttribute LoginCommand command ) {
+        return "login";
+    }
+
+    @RequestMapping(value="/login",method= RequestMethod.POST)
+    public String login(Model model, @ModelAttribute LoginCommand command, BindingResult errors) {
+        loginValidator.validate(command, errors);
+
+        if( errors.hasErrors() ) {
+            return showLoginForm(model, command);
+        }
+
+        UsernamePasswordToken token = new UsernamePasswordToken(command.getUsername(), command.getPassword(), command.isRememberMe());
+        try {
+            SecurityUtils.getSubject().login(token);
+        } catch (AuthenticationException e) {
+            errors.reject( "error.login.generic", "Invalid username or password.  Please try again." );
+        }
+
+        if( errors.hasErrors() ) {
+            return showLoginForm(model, command);
+        } else {
+            return "redirect:/s/home";
+        }
+    }
+
+    @RequestMapping("/logout")
+    public String logout() {
+        SecurityUtils.getSubject().logout();
+        return "redirect:/";
+    }
+
+
+}

Added: incubator/jsecurity/import/trunk/samples/spring-hibernate/src/org/jsecurity/samples/sprhib/web/SignupCommand.java
URL: http://svn.apache.org/viewvc/incubator/jsecurity/import/trunk/samples/spring-hibernate/src/org/jsecurity/samples/sprhib/web/SignupCommand.java?rev=749156&view=auto
==============================================================================
--- incubator/jsecurity/import/trunk/samples/spring-hibernate/src/org/jsecurity/samples/sprhib/web/SignupCommand.java (added)
+++ incubator/jsecurity/import/trunk/samples/spring-hibernate/src/org/jsecurity/samples/sprhib/web/SignupCommand.java Mon Mar  2 03:08:14 2009
@@ -0,0 +1,55 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jsecurity.samples.sprhib.web;
+
+/**
+ * Command binding object for signing up for a new account. 
+ */
+public class SignupCommand {
+
+    private String username;
+
+    private String email;
+
+    private String password;
+
+    public String getUsername() {
+        return username;
+    }
+
+    public void setUsername(String username) {
+        this.username = username;
+    }
+
+    public String getEmail() {
+        return email;
+    }
+
+    public void setEmail(String email) {
+        this.email = email;
+    }
+
+    public String getPassword() {
+        return password;
+    }
+
+    public void setPassword(String password) {
+        this.password = password;
+    }
+}

Added: incubator/jsecurity/import/trunk/samples/spring-hibernate/src/org/jsecurity/samples/sprhib/web/SignupController.java
URL: http://svn.apache.org/viewvc/incubator/jsecurity/import/trunk/samples/spring-hibernate/src/org/jsecurity/samples/sprhib/web/SignupController.java?rev=749156&view=auto
==============================================================================
--- incubator/jsecurity/import/trunk/samples/spring-hibernate/src/org/jsecurity/samples/sprhib/web/SignupController.java (added)
+++ incubator/jsecurity/import/trunk/samples/spring-hibernate/src/org/jsecurity/samples/sprhib/web/SignupController.java Mon Mar  2 03:08:14 2009
@@ -0,0 +1,69 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jsecurity.samples.sprhib.web;
+
+import org.jsecurity.SecurityUtils;
+import org.jsecurity.authc.UsernamePasswordToken;
+import org.jsecurity.samples.sprhib.service.UserService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.ui.Model;
+import org.springframework.validation.BindingResult;
+import org.springframework.web.bind.annotation.ModelAttribute;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestMethod;
+
+/**
+ * Web MVC controller that handles signup requests.
+ */
+@Controller
+public class SignupController {
+
+    private SignupValidator signupValidator = new SignupValidator();
+
+    private UserService userService;
+
+    @Autowired
+    public void setUserService(UserService userService) {
+        this.userService = userService;
+    }
+
+    @RequestMapping(value="/signup",method= RequestMethod.GET)
+    public String showSignupForm(Model model, @ModelAttribute SignupCommand command) {
+        return "signup";
+    }
+
+    @RequestMapping(value="/signup",method= RequestMethod.POST)
+    public String showSignupForm(Model model, @ModelAttribute SignupCommand command, BindingResult errors) {
+        signupValidator.validate(command, errors);
+
+        if( errors.hasErrors() ) {
+            return showSignupForm(model, command);
+        }
+
+        // Create the user
+        userService.createUser( command.getUsername(), command.getEmail(), command.getPassword() );
+
+        // Login the newly created user
+        SecurityUtils.getSubject().login(new UsernamePasswordToken(command.getUsername(), command.getPassword()));
+
+        return "redirect:/s/home";
+    }
+
+}

Added: incubator/jsecurity/import/trunk/samples/spring-hibernate/src/org/jsecurity/samples/sprhib/web/SignupValidator.java
URL: http://svn.apache.org/viewvc/incubator/jsecurity/import/trunk/samples/spring-hibernate/src/org/jsecurity/samples/sprhib/web/SignupValidator.java?rev=749156&view=auto
==============================================================================
--- incubator/jsecurity/import/trunk/samples/spring-hibernate/src/org/jsecurity/samples/sprhib/web/SignupValidator.java (added)
+++ incubator/jsecurity/import/trunk/samples/spring-hibernate/src/org/jsecurity/samples/sprhib/web/SignupValidator.java Mon Mar  2 03:08:14 2009
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.jsecurity.samples.sprhib.web;
+
+import org.jsecurity.util.StringUtils;
+import org.springframework.validation.Errors;
+import org.springframework.validation.ValidationUtils;
+import org.springframework.validation.Validator;
+
+import java.util.regex.Pattern;
+
+/**
+ * Validator for the signup form.
+ */
+public class SignupValidator implements Validator {
+
+    private static final String SIMPLE_EMAIL_REGEX = "[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}";
+
+    public boolean supports(Class aClass) {
+        return SignupCommand.class.isAssignableFrom(aClass);
+    }
+
+    public void validate(Object o, Errors errors) {
+        SignupCommand command = (SignupCommand)o;
+        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "username", "error.username.empty", "Please specify a username.");
+        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "email", "error.email.empty", "Please specify an email address.");
+        if( StringUtils.hasText( command.getEmail() ) && !Pattern.matches( SIMPLE_EMAIL_REGEX, command.getEmail().toUpperCase() ) ) {
+            errors.rejectValue( "email", "error.email.invalid", "Please enter a valid email address." );
+        }
+        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "password", "error.password.empty", "Please specify a password.");
+    }
+}

Copied: incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/applicationContext.xml (from r749109, incubator/jsecurity/import/trunk/samples/spring-hibernate/WEB-INF/applicationContext.xml)
URL: http://svn.apache.org/viewvc/incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/applicationContext.xml?p2=incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/applicationContext.xml&p1=incubator/jsecurity/import/trunk/samples/spring-hibernate/WEB-INF/applicationContext.xml&r1=749109&r2=749156&rev=749156&view=diff
==============================================================================
--- incubator/jsecurity/import/trunk/samples/spring-hibernate/WEB-INF/applicationContext.xml (original)
+++ incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/applicationContext.xml Mon Mar  2 03:08:14 2009
@@ -22,11 +22,23 @@
        xmlns:aop="http://www.springframework.org/schema/aop"
        xmlns:tx="http://www.springframework.org/schema/tx"
        xmlns:util="http://www.springframework.org/schema/util"
-       xsi:schemaLocation="
-       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
+       xmlns:context="http://www.springframework.org/schema/context"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
-       http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd">
+       http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-2.0.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
+
+    <!-- Enable annotation configuration -->
+    <context:annotation-config/>
+
+    <!-- Scan sample packages for Spring annotations -->
+    <context:component-scan base-package="org.jsecurity.samples.sprhib.dao"/>
+    <context:component-scan base-package="org.jsecurity.samples.sprhib.security"/>
+    <context:component-scan base-package="org.jsecurity.samples.sprhib.service"/>
+
+    <!-- Spring AOP auto-proxy creation (required to support JSecurity annotations) -->
+    <bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"/>
+
 
     <!-- Sample RDBMS data source that would exist in any application.  Sample is just using an in-memory HSQLDB
          instance.  Change to your application's settings for a real app. -->
@@ -37,24 +49,19 @@
     </bean>
 
     <!-- Hibernate SessionFactory -->
-    <bean id="hibernateSessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
+    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
         <property name="dataSource" ref="dataSource"/>
         <!-- Because we're using an in-memory database for demo purposes (which is lost every time the app
              shuts down), we have to ensure that the HSQLDB DDL is run each time the app starts.  The
              DDL is auto-generated based on the *.hbm.xml mapping definitions below. -->
         <property name="schemaUpdate" value="true"/>
-        <property name="mappingResources">
-            <list>
-                <value>Person.hbm.xml</value>
-                <value>Role.hbm.xml</value>
-                <value>User.hbm.xml</value>
-            </list>
-        </property>
+        <!-- Scan packages for JPA annotations -->
+        <property name="packagesToScan" value="org.jsecurity.samples.sprhib.model"/>
         <property name="hibernateProperties">
             <props>
                 <prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop>
-                <prop key="hibernate.cache.provider_class">org.hibernate.cache.EhCacheProvider</prop>
-                <!-- <prop key="hibernate.show_sql">true</prop> -->
+                <prop key="hibernate.jdbc.fetch_size">100</prop>
+                <prop key="hibernate.cache.provider_class">net.sf.ehcache.hibernate.SingletonEhCacheProvider</prop>
             </props>
         </property>
         <property name="eventListeners">
@@ -66,69 +73,32 @@
         </property>
     </bean>
 
+    <!-- Transaction support beans -->
     <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
-        <property name="sessionFactory" ref="hibernateSessionFactory"/>
+        <property name="sessionFactory" ref="sessionFactory"/>
     </bean>
-    <tx:annotation-driven/>
 
-    <!-- Populates the sample database with sample users and roles. This would probably not exist
-         in a real application: - ->
-   <bean id="bootstrapDataPopulator" class="org.jsecurity.samples.spring.BootstrapDataPopulator">
-       <property name="dataSource" ref="dataSource"/>
-   </bean> -->
-
-    <!-- The sample app's User DAO for User CRUD operations.  Used by the JSecurity Realm
-         to query for Users during login and access control checks, but would be used in other places in a
-         'real' application too (e.g. UserManager/UserService, etc). -->
-    <bean id="userDAO" class="org.jsecurity.samples.sprhib.party.eis.HibernateUserDAO">
-        <property name="sessionFactory" ref="hibernateSessionFactory"/>
-    </bean>
+    <tx:annotation-driven/>
 
 
     <!-- =========================================================
-         JSecurity Core Components - Not Spring-pecific, just Spring-configured
+         JSecurity Components
          ========================================================= -->
+
     <!-- JSecurity's main business-tier object for web-enabled applications
          (use org.jsecurity.mgt.DefaultSecurityManager instead when there is no web environment)-->
     <bean id="securityManager" class="org.jsecurity.web.DefaultWebSecurityManager">
         <!-- Single realm app (realm configured next, below).  If you have multiple realms, use the 'realms'
       property instead. -->
-        <property name="realm" ref="realm"/>
+        <property name="realm" ref="sampleRealm"/>
         <!-- Uncomment this next property if you want heterogenous session access or clusterable/distributable
              sessions.  The default value is 'http' which uses the Servlet container's HttpSession as the underlying
              Session implementation.
-     <property name="sessionMode" value="jsecurity"/> -->
+        <property name="sessionMode" value="jsecurity"/> -->
     </bean>
 
-    <!-- Used our sample DefaultRealm which uses our Hibernate UserDAO: -->
-    <bean id="realm" class="org.jsecurity.samples.sprhib.security.DefaultRealm">
-        <property name="userDAO" ref="userDAO"/>
 
-    </bean>
-
-
-    <!-- =========================================================
-         JSecurity Spring-specific integration
-         ========================================================= -->
-    <!-- Post processor that automatically invokes init() and destroy() methods
-         for Spring-configured JSecurity objects so you don't have to
-         1) specify an init-method and destroy-method attributes for every bean
-            definition and
-         2) even know which JSecurity objects require these methods to be
-            called. -->
+    <!-- Post processor that automatically invokes init() and destroy() methods -->
     <bean id="lifecycleBeanPostProcessor" class="org.jsecurity.spring.LifecycleBeanPostProcessor"/>
 
-    <!-- Enable JSecurity Annotations for Spring-configured beans.  Only run after
-         the lifecycleBeanProcessor has run: -->
-    <bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"
-          depends-on="lifecycleBeanPostProcessor"/>
-    <bean class="org.jsecurity.spring.security.interceptor.AuthorizationAttributeSourceAdvisor">
-        <property name="securityManager" ref="securityManager"/>
-    </bean>
-    <!-- Secure Spring remoting:  Ensure any Spring Remoting method invocations can be associated
-         with a Subject for security checks. -->
-    <bean id="secureRemoteInvocationExecutor" class="org.jsecurity.spring.remoting.SecureRemoteInvocationExecutor">
-        <property name="securityManager" ref="securityManager"/>
-    </bean>
-
 </beans>

Added: incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/classes/ehcache.xml
URL: http://svn.apache.org/viewvc/incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/classes/ehcache.xml?rev=749156&view=auto
==============================================================================
--- incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/classes/ehcache.xml (added)
+++ incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/classes/ehcache.xml Mon Mar  2 03:08:14 2009
@@ -0,0 +1,46 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<ehcache>
+
+    <diskStore path="java.io.tmpdir/jsecurity-spring-hibernate-ehcache"/>
+
+
+    <defaultCache
+        maxElementsInMemory="1000"
+        eternal="false"
+        timeToLiveSeconds="600"
+        overflowToDisk="true"
+        diskPersistent="false"
+        />
+
+    <!--=================================================================
+        Hibernate Object Caches
+        =================================================================-->
+
+    <cache name="org.jsecurity.samples.sprhib.model.Role"
+        maxElementsInMemory="100"
+        timeToLiveSeconds="0"
+        overflowToDisk="true"/>
+
+    <cache name="org.jsecurity.samples.sprhib.model.User"
+        maxElementsInMemory="1000"
+        timeToLiveSeconds="3600"
+        overflowToDisk="true"/>
+
+</ehcache>
\ No newline at end of file

Added: incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/classes/hibernate.cfg.xml
URL: http://svn.apache.org/viewvc/incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/classes/hibernate.cfg.xml?rev=749156&view=auto
==============================================================================
--- incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/classes/hibernate.cfg.xml (added)
+++ incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/classes/hibernate.cfg.xml Mon Mar  2 03:08:14 2009
@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<!DOCTYPE hibernate-configuration PUBLIC
+  "-//Hibernate/Hibernate Configuration DTD//EN"
+  "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
+
+<!-- This file is largely provided for IDE/tool support, and is NOT used at runtime -->
+
+<hibernate-configuration>
+  <session-factory>
+    <!-- DB schema will be updated if needed -->
+    <property name="hbm2ddl.auto">update</property>
+
+    <mapping class="org.jsecurity.samples.sprhib.model.Role"/>
+    <mapping class="org.jsecurity.samples.sprhib.model.User"/>
+
+  </session-factory>
+</hibernate-configuration>
\ No newline at end of file

Added: incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/jsp/editUser.jsp
URL: http://svn.apache.org/viewvc/incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/jsp/editUser.jsp?rev=749156&view=auto
==============================================================================
--- incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/jsp/editUser.jsp (added)
+++ incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/jsp/editUser.jsp Mon Mar  2 03:08:14 2009
@@ -0,0 +1,52 @@
+<%--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  --%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
+
+<html>
+<head>
+    <title>JSecurity Spring-Hibernate Sample Application</title>
+    <link rel="stylesheet" type="text/css" href="<c:url value="/styles/sample.css"/>"/>
+</head>
+<body>
+    <div id="box">
+        <div class="title">JSecurity Spring-Hibernate - Edit User</div>
+
+        <div class="content">
+            <form:form modelAttribute="editUserCommand">
+
+                <form:errors path="*" element="div" cssClass="errors"/>
+                <div><div class="form-label">Username:</div><form:input path="username"/></div>
+                <div><div class="form-label">Email:</div><form:input path="email"/></div>
+                <div><div class="form-label">Password:</div><form:password path="password"/></div>
+                <div><input type="button" onclick="document.location.href='<c:url value="/s/manageUsers"/>'" value="Cancel"/>&nbsp;<input type="submit" value="Save Changes"/></div>
+            </form:form>
+
+            <p>Only edit the password field if you want to change the user's password.  Otherwise leave password blank.</p>
+            
+        </div>
+
+    </div>
+
+    <script type="text/javascript">
+        document.getElementById('username').focus();
+    </script>
+
+</body>
+</html>
\ No newline at end of file

Added: incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/jsp/home.jsp
URL: http://svn.apache.org/viewvc/incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/jsp/home.jsp?rev=749156&view=auto
==============================================================================
--- incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/jsp/home.jsp (added)
+++ incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/jsp/home.jsp Mon Mar  2 03:08:14 2009
@@ -0,0 +1,55 @@
+<%--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  --%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib prefix="jsec" uri="http://www.jsecurity.org/tags" %>
+
+<html>
+<head>
+    <title>JSecurity Spring-Hibernate Sample Application</title>
+    <link rel="stylesheet" type="text/css" href="<c:url value="/styles/sample.css"/>"/>
+</head>
+<body>
+
+<div id="bigbox">
+    <div class="title clearfix"><div style="float: left">JSecurity Spring-Hibernate - Home</div><div class="info" >Logged in as ${currentUser.username} (<a href="<c:url value="/s/logout"/>">Logout</a>)</div></div>
+
+
+    <div class="content">
+
+        <p>Users in the system:</p>
+        <ul>
+            <c:forEach var="user" items="${users}">
+                <li>${user.username} - ${user.email}</li>
+            </c:forEach>
+        </ul>
+
+        <p>
+        <jsec:hasPermission name="user:manage">
+            Since you are logged in as the admin user, you can <a href="<c:url value="/s/manageUsers"/>">manage site users</a>.
+        </jsec:hasPermission>
+        <jsec:lacksPermission name="user:manage">
+            Since you are not logged in as the admin user, you can't manage site users.
+        </jsec:lacksPermission>
+        </p>
+    </div>
+
+</div>
+
+</body>
+</html>
\ No newline at end of file

Added: incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/jsp/login.jsp
URL: http://svn.apache.org/viewvc/incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/jsp/login.jsp?rev=749156&view=auto
==============================================================================
--- incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/jsp/login.jsp (added)
+++ incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/jsp/login.jsp Mon Mar  2 03:08:14 2009
@@ -0,0 +1,56 @@
+<%--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  --%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
+
+<html>
+<head>
+    <title>JSecurity Spring-Hibernate Sample Application</title>
+    <link rel="stylesheet" type="text/css" href="<c:url value="/styles/sample.css"/>"/> 
+</head>
+<body>
+    <div id="box">
+        <div class="title">JSecurity Spring-Hibernate - Login</div>
+
+        <div class="content">
+            <form:form modelAttribute="loginCommand">
+
+                <form:errors path="*" element="div" cssClass="errors"/>
+
+                <div><div class="form-label">Username:</div><form:input path="username"/></div>
+                <div><div class="form-label">Password:</div><form:password path="password"/></div>
+                <div><form:checkbox path="rememberMe"/> Remember Me</div>
+                <div><input type="submit" value="Login"/></div>
+            </form:form>
+
+            <div>Don't have an account? <a href="<c:url value="/s/signup"/>">Sign up</a></div>
+        </div>
+    </div>
+
+    <p>
+        Users created through the signup form have the role "user".  You can also log in as admin/admin, which has the
+        "admin" role.
+    </p>
+
+    <script type="text/javascript">
+        document.getElementById('username').focus();
+    </script>
+
+</body>
+</html>
\ No newline at end of file

Added: incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/jsp/manageUsers.jsp
URL: http://svn.apache.org/viewvc/incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/jsp/manageUsers.jsp?rev=749156&view=auto
==============================================================================
--- incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/jsp/manageUsers.jsp (added)
+++ incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/jsp/manageUsers.jsp Mon Mar  2 03:08:14 2009
@@ -0,0 +1,57 @@
+<%--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  --%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib prefix="jsec" uri="http://www.jsecurity.org/tags" %>
+
+<html>
+<head>
+    <title>JSecurity Spring-Hibernate Sample Application</title>
+    <link rel="stylesheet" type="text/css" href="<c:url value="/styles/sample.css"/>"/>
+</head>
+<body>
+
+<div id="bigbox">
+    <div class="title clearfix"><div style="float: left">JSecurity Spring-Hibernate - Manage Users</div><div class="info" >Logged in as ${currentUser.username} (<a href="<c:url value="/s/logout"/>">Logout</a>)</div></div>
+
+
+    <div class="content">
+
+        <table id="manageUsers">
+            <tr>
+                <th>Username</th>
+                <th>Email</th>
+                <th>Actions</th>
+            </tr>
+            <c:forEach var="user" items="${users}">
+            <tr>
+                <td>${user.username}</td>
+                <td>${user.email}</td>
+                <td><a href="<c:url value="/s/editUser?userId=${user.id}"/>">Edit</a><c:if test="${user.id ne 1}">&nbsp;|&nbsp;<a href="<c:url value="/s/deleteUser?userId=${user.id}"/>">Delete</a></c:if>
+                </td>
+            </tr>
+            </c:forEach>
+        </table>
+
+        <p>Return to <a href="<c:url value="/s/home"/>">Home</a></p>
+    </div>
+
+</div>
+
+</body>
+</html>
\ No newline at end of file

Added: incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/jsp/signup.jsp
URL: http://svn.apache.org/viewvc/incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/jsp/signup.jsp?rev=749156&view=auto
==============================================================================
--- incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/jsp/signup.jsp (added)
+++ incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/jsp/signup.jsp Mon Mar  2 03:08:14 2009
@@ -0,0 +1,49 @@
+<%--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  --%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<%@ taglib prefix="form" uri="http://www.springframework.org/tags/form" %>
+
+<html>
+<head>
+    <title>JSecurity Spring-Hibernate Sample Application</title>
+    <link rel="stylesheet" type="text/css" href="<c:url value="/styles/sample.css"/>"/>
+</head>
+<body>
+    <div id="box">
+        <div class="title">JSecurity Spring-Hibernate - Signup</div>
+
+        <div class="content">
+            <form:form modelAttribute="signupCommand">
+
+                <form:errors path="*" element="div" cssClass="errors"/>
+
+                <div><div class="form-label">Username:</div><form:input path="username"/></div>
+                <div><div class="form-label">Email:</div><form:input path="email"/></div>
+                <div><div class="form-label">Password:</div><form:password path="password"/></div>
+                <div><input type="button" onclick="document.location.href='<c:url value="/s/login"/>'" value="Cancel"/>&nbsp;<input type="submit" value="Signup"/></div>
+            </form:form>
+        </div>
+    </div>
+
+    <script type="text/javascript">
+        document.getElementById('username').focus();
+    </script>
+
+</body>
+</html>
\ No newline at end of file

Added: incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/sprhib-servlet.xml
URL: http://svn.apache.org/viewvc/incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/sprhib-servlet.xml?rev=749156&view=auto
==============================================================================
--- incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/sprhib-servlet.xml (added)
+++ incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/sprhib-servlet.xml Mon Mar  2 03:08:14 2009
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  -->
+<beans xmlns="http://www.springframework.org/schema/beans"
+    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+    xmlns:p="http://www.springframework.org/schema/p"
+    xmlns:context="http://www.springframework.org/schema/context"
+    xsi:schemaLocation="
+        http://www.springframework.org/schema/beans
+        http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
+        http://www.springframework.org/schema/context
+        http://www.springframework.org/schema/context/spring-context-2.5.xsd">
+
+    <!-- Enable annotation component scanning and autowiring of web package -->
+    <context:annotation-config/>
+    <context:component-scan base-package="org.jsecurity.samples.sprhib.web"/>
+
+    <!-- Required for security annotations to work in this servlet -->
+    <bean class="org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator"/>
+    <bean class="org.jsecurity.spring.security.interceptor.AuthorizationAttributeSourceAdvisor"/>
+
+
+    <!-- Enable annotation-based controllers using @Controller annotations -->
+    <bean id="annotationUrlMapping" class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
+        <property name="interceptors" ref="currentUserInterceptor"/>
+    </bean>
+
+    <bean id="annotationMethodHandlerAdapter" class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"/>
+
+    <!-- All views are JSPs loaded from /WEB-INF/jsp -->
+    <bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
+        <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
+        <property name="prefix" value="/WEB-INF/jsp/"/>
+        <property name="suffix" value=".jsp"/>
+    </bean>    
+
+</beans>
\ No newline at end of file

Copied: incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/web.xml (from r749109, incubator/jsecurity/import/trunk/samples/spring-hibernate/WEB-INF/web.xml)
URL: http://svn.apache.org/viewvc/incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/web.xml?p2=incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/web.xml&p1=incubator/jsecurity/import/trunk/samples/spring-hibernate/WEB-INF/web.xml&r1=749109&r2=749156&rev=749156&view=diff
==============================================================================
--- incubator/jsecurity/import/trunk/samples/spring-hibernate/WEB-INF/web.xml (original)
+++ incubator/jsecurity/import/trunk/samples/spring-hibernate/web/WEB-INF/web.xml Mon Mar  2 03:08:14 2009
@@ -22,104 +22,106 @@
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
 
-  <!-- ===================================================================
-   -  Context parameters
-   -  =================================================================== -->
-  <context-param>
-    <param-name>contextConfigLocation</param-name>
-    <param-value>
-      /WEB-INF/applicationContext.xml
-    </param-value>
-  </context-param>
+    <!-- ===================================================================
+ -  Context parameters
+ -  =================================================================== -->
+    <context-param>
+        <param-name>contextConfigLocation</param-name>
+        <param-value>
+            /WEB-INF/applicationContext.xml
+        </param-value>
+    </context-param>
 
-  <!--
+    <!--
     - Key of the system property that should specify the root directory of this
     - web app. Applied by WebAppRootListener or Log4jConfigListener.
     -->
-  <context-param>
-    <param-name>webAppRootKey</param-name>
-    <param-value>jsecurity-spring-hibernate-sample.webapp.root</param-value>
-  </context-param>
-
-  <!-- ===================================================================
-   -  Servlet listeners
-   -  =================================================================== -->
-  <listener>
-    <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
-  </listener>
-  <listener>
-    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
-  </listener>
-
-  <!-- ===================================================================
-   -  Filters
-   -  =================================================================== -->
-  <filter>
-    <filter-name>JSecurityFilter</filter-name>
-    <filter-class>org.jsecurity.spring.SpringJSecurityFilter</filter-class>
-    <init-param>
-      <param-name>config</param-name>
-      <param-value>
-
-        # The JSecurityFilter configuration is very powerful and flexible, while still remaining succinct.
-        # Please read the comprehensive example, with full comments and explanations, in the JavaDoc:
-        #
-        # http://www.jsecurity.org/api/org/jsecurity/web/servlet/JSecurityFilter.html
-
-        [filters]
-        jsecurity.loginUrl = /s/login
-        authc.successUrl = /s/index
-
-
-        [urls]
-        /s/index=authc
-        /s/jsecurity.jnlp=authc|user
-        /remoting/**=authenticated|permission.remote:invoke
-      </param-value>
-    </init-param>
-
-  </filter>
-
-  <filter-mapping>
-    <filter-name>JSecurityFilter</filter-name>
-    <url-pattern>/s/*</url-pattern>
-  </filter-mapping>
-  <filter-mapping>
-    <filter-name>JSecurityFilter</filter-name>
-    <url-pattern>/remoting/*</url-pattern>
-  </filter-mapping>
-
-
-  <!-- ===================================================================
-   -  Servlets
-   -  =================================================================== -->
-  <!-- <servlet>
-     <servlet-name>sample</servlet-name>
-     <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
-     <load-on-startup>1</load-on-startup>
- </servlet>
-
- <servlet-mapping>
-     <servlet-name>sample</servlet-name>
-     <url-pattern>/s/*</url-pattern>
- </servlet-mapping>
-
- <servlet>
-     <servlet-name>remoting</servlet-name>
-     <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
-     <load-on-startup>1</load-on-startup>
- </servlet>
-
- <servlet-mapping>
-     <servlet-name>remoting</servlet-name>
-     <url-pattern>/remoting/*</url-pattern>
- </servlet-mapping> -->
-
-  <!-- ===================================================================
-   -  Welcome file list
-   -  =================================================================== -->
-  <!-- <welcome-file-list>
-     <welcome-file>index.jsp</welcome-file>
- </welcome-file-list> -->
+    <context-param>
+        <param-name>webAppRootKey</param-name>
+        <param-value>jsecurity-spring-hibernate-sample.webapp.root</param-value>
+    </context-param>
+
+    <!-- ===================================================================
+ -  Servlet listeners
+ -  =================================================================== -->
+    <listener>
+        <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
+    </listener>
+    <listener>
+        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+    </listener>
+
+    <!-- ===================================================================
+ -  Filters
+ -  =================================================================== -->
+    <filter>
+        <filter-name>openSessionInViewFilter</filter-name>
+        <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
+    </filter>
+
+    <filter>
+        <filter-name>JSecurityFilter</filter-name>
+        <filter-class>org.jsecurity.spring.SpringJSecurityFilter</filter-class>
+        <init-param>
+            <param-name>config</param-name>
+            <param-value>
+
+                # The JSecurityFilter configuration is very powerful and flexible, while still remaining succinct.
+                # Please read the comprehensive example, with full comments and explanations, in the JavaDoc:
+                #
+                # http://www.jsecurity.org/api/org/jsecurity/web/servlet/JSecurityFilter.html
+
+                [filters]
+                # Override the authentication filter to pass thru so we can handle login logic in our controller
+                authc = org.jsecurity.web.filter.authc.PassThruAuthenticationFilter
+                jsecurity.loginUrl = /s/login
+                jsecurity.unauthorizedUrl = /unauthorized.jsp
+                authc.successUrl = /s/home
+
+                [urls]
+                /s/signup=anon
+                /s/manageUsers=perms[user:manage]
+                /s/**=authc
+            </param-value>
+        </init-param>
+
+    </filter>
+
+    <filter-mapping>
+        <filter-name>openSessionInViewFilter</filter-name>
+        <url-pattern>/s/*</url-pattern>
+    </filter-mapping>
+
+    <filter-mapping>
+        <filter-name>JSecurityFilter</filter-name>
+        <url-pattern>/s/*</url-pattern>
+    </filter-mapping>
+
+    <!-- ===================================================================
+ -  Servlets
+ -  =================================================================== -->
+    <servlet>
+        <servlet-name>sprhib</servlet-name>
+        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
+        <load-on-startup>1</load-on-startup>
+    </servlet>
+
+    <servlet-mapping>
+        <servlet-name>sprhib</servlet-name>
+        <url-pattern>/s/*</url-pattern>
+    </servlet-mapping>
+
+
+    <!-- ===================================================================
+     -  Welcome file list
+     -  =================================================================== -->
+   <welcome-file-list>
+       <welcome-file>index.jsp</welcome-file>
+   </welcome-file-list>
+
+    <error-page>
+        <error-code>401</error-code>
+        <location>/unauthorized.jsp</location>
+    </error-page>
 
 </web-app>

Added: incubator/jsecurity/import/trunk/samples/spring-hibernate/web/index.jsp
URL: http://svn.apache.org/viewvc/incubator/jsecurity/import/trunk/samples/spring-hibernate/web/index.jsp?rev=749156&view=auto
==============================================================================
--- incubator/jsecurity/import/trunk/samples/spring-hibernate/web/index.jsp (added)
+++ incubator/jsecurity/import/trunk/samples/spring-hibernate/web/index.jsp Mon Mar  2 03:08:14 2009
@@ -0,0 +1,22 @@
+<%--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  --%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+
+<%-- Redirect to index page --%>
+<c:redirect url="/s/home"/>
\ No newline at end of file

Added: incubator/jsecurity/import/trunk/samples/spring-hibernate/web/styles/sample.css
URL: http://svn.apache.org/viewvc/incubator/jsecurity/import/trunk/samples/spring-hibernate/web/styles/sample.css?rev=749156&view=auto
==============================================================================
--- incubator/jsecurity/import/trunk/samples/spring-hibernate/web/styles/sample.css (added)
+++ incubator/jsecurity/import/trunk/samples/spring-hibernate/web/styles/sample.css Mon Mar  2 03:08:14 2009
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+body { font-family:"Lucida Grande","Lucida Sans Unicode",Arial,Verdana,sans-serif; color: #333; font-size: 12px; background: #f6f6f6}
+
+#box { width: 500px; }
+#bigbox { width: 940px; }
+#bigbox, #box { margin: 30px; padding: 0; border: thin black solid; background: #fff}
+#bigbox .title, #box .title { display: block; margin: 0 0 5px 0; padding: 5px; background: #ddd; font-size: 18px}
+#bigbox .title .info { float: right; padding-right: 10px; font-size: 12px}
+
+.errors { color: red; padding: 10px 0 10px 0; }
+.form-label { float: left; width: 100px;}
+
+.content { padding: 10px;}
+.content div { padding: 5px; 0 5px 0 }
+
+#manageUsers { width: 800px }
+#manageUsers th { text-align: left }
+
+a:active, a:visited, a:link { color: #6666DD; text-decoration: none; }
+a:hover { color: #6666FF; text-decoration: underline; }
+
+.clearfix:after {content:".";display:block;height:0;clear:both;visibility:hidden;}
+.clearfix {display:inline-block;}
+* html .clearfix {height:1%;}
+.clearfix {display:block;}
\ No newline at end of file

Added: incubator/jsecurity/import/trunk/samples/spring-hibernate/web/unauthorized.jsp
URL: http://svn.apache.org/viewvc/incubator/jsecurity/import/trunk/samples/spring-hibernate/web/unauthorized.jsp?rev=749156&view=auto
==============================================================================
--- incubator/jsecurity/import/trunk/samples/spring-hibernate/web/unauthorized.jsp (added)
+++ incubator/jsecurity/import/trunk/samples/spring-hibernate/web/unauthorized.jsp Mon Mar  2 03:08:14 2009
@@ -0,0 +1,29 @@
+<%--
+  ~ Licensed to the Apache Software Foundation (ASF) under one
+  ~ or more contributor license agreements.  See the NOTICE file
+  ~ distributed with this work for additional information
+  ~ regarding copyright ownership.  The ASF licenses this file
+  ~ to you under the Apache License, Version 2.0 (the
+  ~ "License"); you may not use this file except in compliance
+  ~ with the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing,
+  ~ software distributed under the License is distributed on an
+  ~ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+  ~ KIND, either express or implied.  See the License for the
+  ~ specific language governing permissions and limitations
+  ~ under the License.
+  --%>
+<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
+<html>
+<head>
+    <title>JSecurity Spring-Hibernate Sample Application</title>
+    <link rel="stylesheet" type="text/css" href="<c:url value="/styles/sample.css"/>"/>
+</head>
+<body>
+<h3>Unauthorized</h3>
+<p>You are not authorized to access the requested page.  Please return to the <a href="<c:url value="/s/home"/>">homepage</a>.</p>
+</body>
+</html>
\ No newline at end of file

Modified: incubator/jsecurity/import/trunk/samples/standalone/standalone.iml
URL: http://svn.apache.org/viewvc/incubator/jsecurity/import/trunk/samples/standalone/standalone.iml?rev=749156&r1=749155&r2=749156&view=diff
==============================================================================
--- incubator/jsecurity/import/trunk/samples/standalone/standalone.iml (original)
+++ incubator/jsecurity/import/trunk/samples/standalone/standalone.iml Mon Mar  2 03:08:14 2009
@@ -8,7 +8,6 @@
     <orderEntry type="inheritedJdk" />
     <orderEntry type="sourceFolder" forTests="false" />
     <orderEntry type="module" module-name="jsecurity" />
-    <orderEntryProperties />
   </component>
   <component name="copyright">
     <Base>