You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shiro.apache.org by bd...@apache.org on 2016/10/21 14:26:29 UTC

[1/9] shiro git commit: SHIRO-586 - Change getRoleNamesForUser from private to protected so that it can be used in sub-classes

Repository: shiro
Updated Branches:
  refs/heads/1.4.x d8efb4fd1 -> 921753e82


SHIRO-586 - Change getRoleNamesForUser from private to protected so that it can be used in sub-classes


Project: http://git-wip-us.apache.org/repos/asf/shiro/repo
Commit: http://git-wip-us.apache.org/repos/asf/shiro/commit/2466e223
Tree: http://git-wip-us.apache.org/repos/asf/shiro/tree/2466e223
Diff: http://git-wip-us.apache.org/repos/asf/shiro/diff/2466e223

Branch: refs/heads/1.4.x
Commit: 2466e22338ff44959335bc227dfe1ffc3bee0765
Parents: d8efb4f
Author: andrewmorgan <an...@formicary.net>
Authored: Sat Sep 24 02:11:55 2016 -0400
Committer: Brian Demers <bd...@apache.org>
Committed: Wed Oct 19 14:45:40 2016 -0400

----------------------------------------------------------------------
 .../apache/shiro/realm/activedirectory/ActiveDirectoryRealm.java   | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/shiro/blob/2466e223/core/src/main/java/org/apache/shiro/realm/activedirectory/ActiveDirectoryRealm.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/shiro/realm/activedirectory/ActiveDirectoryRealm.java b/core/src/main/java/org/apache/shiro/realm/activedirectory/ActiveDirectoryRealm.java
index 6926a99..49a8e46 100644
--- a/core/src/main/java/org/apache/shiro/realm/activedirectory/ActiveDirectoryRealm.java
+++ b/core/src/main/java/org/apache/shiro/realm/activedirectory/ActiveDirectoryRealm.java
@@ -155,7 +155,7 @@ public class ActiveDirectoryRealm extends AbstractLdapRealm {
         return new SimpleAuthorizationInfo(roleNames);
     }
 
-    private Set<String> getRoleNamesForUser(String username, LdapContext ldapContext) throws NamingException {
+    protected Set<String> getRoleNamesForUser(String username, LdapContext ldapContext) throws NamingException {
         Set<String> roleNames;
         roleNames = new LinkedHashSet<String>();
 


[3/9] shiro git commit: SHIRO-587 - Expose searchFilter as a property that can be set in the ini

Posted by bd...@apache.org.
SHIRO-587 - Expose searchFilter as a property that can be set in the ini


Project: http://git-wip-us.apache.org/repos/asf/shiro/repo
Commit: http://git-wip-us.apache.org/repos/asf/shiro/commit/0061bc4e
Tree: http://git-wip-us.apache.org/repos/asf/shiro/tree/0061bc4e
Diff: http://git-wip-us.apache.org/repos/asf/shiro/diff/0061bc4e

Branch: refs/heads/1.4.x
Commit: 0061bc4edd78587afab6ed63d6216f245dffea85
Parents: a85e2d7
Author: opticyclic <op...@gmail.com>
Authored: Wed Sep 28 19:03:54 2016 -0400
Committer: Brian Demers <bd...@apache.org>
Committed: Wed Oct 19 14:46:30 2016 -0400

----------------------------------------------------------------------
 .../shiro/realm/activedirectory/ActiveDirectoryRealm.java    | 2 --
 .../java/org/apache/shiro/realm/ldap/AbstractLdapRealm.java  | 8 ++++++++
 2 files changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/shiro/blob/0061bc4e/core/src/main/java/org/apache/shiro/realm/activedirectory/ActiveDirectoryRealm.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/shiro/realm/activedirectory/ActiveDirectoryRealm.java b/core/src/main/java/org/apache/shiro/realm/activedirectory/ActiveDirectoryRealm.java
index 49a8e46..39fa4b6 100644
--- a/core/src/main/java/org/apache/shiro/realm/activedirectory/ActiveDirectoryRealm.java
+++ b/core/src/main/java/org/apache/shiro/realm/activedirectory/ActiveDirectoryRealm.java
@@ -167,8 +167,6 @@ public class ActiveDirectoryRealm extends AbstractLdapRealm {
             userPrincipalName += principalSuffix;
         }
 
-        //SHIRO-115 - prevent potential code injection:
-        String searchFilter = "(&(objectClass=*)(userPrincipalName={0}))";
         Object[] searchArguments = new Object[]{userPrincipalName};
 
         NamingEnumeration answer = ldapContext.search(searchBase, searchFilter, searchArguments, searchCtls);

http://git-wip-us.apache.org/repos/asf/shiro/blob/0061bc4e/core/src/main/java/org/apache/shiro/realm/ldap/AbstractLdapRealm.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/shiro/realm/ldap/AbstractLdapRealm.java b/core/src/main/java/org/apache/shiro/realm/ldap/AbstractLdapRealm.java
index cfd3519..25458c9 100644
--- a/core/src/main/java/org/apache/shiro/realm/ldap/AbstractLdapRealm.java
+++ b/core/src/main/java/org/apache/shiro/realm/ldap/AbstractLdapRealm.java
@@ -73,6 +73,9 @@ public abstract class AbstractLdapRealm extends AuthorizingRealm {
 
     protected String systemPassword = null;
 
+    //SHIRO-115 - prevent potential code injection:
+    protected String searchFilter = "(&(objectClass=*)(userPrincipalName={0}))";
+
     private LdapContextFactory ldapContextFactory = null;
 
     /*--------------------------------------------
@@ -157,6 +160,11 @@ public abstract class AbstractLdapRealm extends AuthorizingRealm {
         this.ldapContextFactory = ldapContextFactory;
     }
 
+
+    public void setSearchFilter(String searchFilter) {
+        this.searchFilter = searchFilter;
+    }
+
     /*--------------------------------------------
     |               M E T H O D S                |
     ============================================*/


[6/9] shiro git commit: Update groovy dependency version to 2.4.7

Posted by bd...@apache.org.
Update groovy dependency version to 2.4.7


Project: http://git-wip-us.apache.org/repos/asf/shiro/repo
Commit: http://git-wip-us.apache.org/repos/asf/shiro/commit/29957a93
Tree: http://git-wip-us.apache.org/repos/asf/shiro/tree/29957a93
Diff: http://git-wip-us.apache.org/repos/asf/shiro/diff/29957a93

Branch: refs/heads/1.4.x
Commit: 29957a93eab98a7cfa5016d143f3fab52bf5d680
Parents: f9688b2
Author: Brian Demers <bd...@apache.org>
Authored: Thu Oct 20 11:08:00 2016 -0400
Committer: Brian Demers <bd...@apache.org>
Committed: Thu Oct 20 11:08:00 2016 -0400

----------------------------------------------------------------------
 pom.xml | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/shiro/blob/29957a93/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index a6acd76..05aea3a 100644
--- a/pom.xml
+++ b/pom.xml
@@ -97,7 +97,7 @@
         <!-- Test 3rd-party dependencies: -->
         <easymock.version>3.4</easymock.version>
         <gmaven.version>1.3</gmaven.version>
-        <groovy.version>1.8.5</groovy.version>
+        <groovy.version>2.4.7</groovy.version>
         <junit.version>4.12</junit.version>
         <!-- so we can mock static methods in 3rd party libraries that sometimes don't use proper interfaces
              ahem, hazelcast, ahem... -->
@@ -834,6 +834,11 @@
                 <version>${groovy.version}</version>
             </dependency>
             <dependency>
+                <groupId>org.codehaus.groovy</groupId>
+                <artifactId>groovy</artifactId>
+                <version>${groovy.version}</version>
+            </dependency>
+            <dependency>
                 <groupId>net.sf.ehcache</groupId>
                 <artifactId>ehcache-core</artifactId>
                 <version>${ehcache.version}</version>


[5/9] shiro git commit: Cleaned up duplicated integration test code

Posted by bd...@apache.org.
Cleaned up duplicated integration test code

The AbstractContainerIT was getting copied around a bit, this has been moved to a new 'integration-tests/support' module.


Project: http://git-wip-us.apache.org/repos/asf/shiro/repo
Commit: http://git-wip-us.apache.org/repos/asf/shiro/commit/f9688b27
Tree: http://git-wip-us.apache.org/repos/asf/shiro/tree/f9688b27
Diff: http://git-wip-us.apache.org/repos/asf/shiro/diff/f9688b27

Branch: refs/heads/1.4.x
Commit: f9688b275daa766c8e4969bc9d77bbe03ae132ac
Parents: 822cef5
Author: Brian Demers <bd...@apache.org>
Authored: Thu Oct 20 11:06:39 2016 -0400
Committer: Brian Demers <bd...@apache.org>
Committed: Thu Oct 20 11:06:39 2016 -0400

----------------------------------------------------------------------
 integration-tests/guice3/pom.xml                |   7 +-
 .../samples/guice/AbstractContainerIT.java      | 142 -----------------
 .../samples/guice/ContainerIntegrationIT.java   |   2 +
 integration-tests/guice4/pom.xml                |   5 +-
 .../samples/guice/AbstractContainerIT.java      | 142 -----------------
 .../samples/guice/ContainerIntegrationIT.java   |   2 +
 integration-tests/pom.xml                       |   1 +
 integration-tests/support/pom.xml               |  96 ++++++++++++
 .../shiro/testing/web/AbstractContainerIT.java  | 153 +++++++++++++++++++
 pom.xml                                         |  18 ++-
 samples/guice/pom.xml                           |  13 +-
 .../samples/guice/AbstractContainerIT.java      | 142 -----------------
 .../samples/guice/ContainerIntegrationIT.java   |   1 +
 samples/jaxrs/pom.xml                           |   5 +-
 .../web/jaxrs/ContainerIntegrationIT.groovy     |   1 +
 .../shiro/web/jaxrs/AbstractContainerIT.java    | 148 ------------------
 samples/servlet-plugin/pom.xml                  |   8 +-
 .../apache/shiro/test/AbstractContainerIT.java  | 147 ------------------
 .../shiro/test/ContainerIntegrationIT.java      |   1 +
 samples/web/pom.xml                             |  13 +-
 .../apache/shiro/test/AbstractContainerIT.java  | 145 ------------------
 .../shiro/test/ContainerIntegrationIT.java      |   1 +
 22 files changed, 292 insertions(+), 901 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/shiro/blob/f9688b27/integration-tests/guice3/pom.xml
----------------------------------------------------------------------
diff --git a/integration-tests/guice3/pom.xml b/integration-tests/guice3/pom.xml
index 1f4b674..5139cef 100644
--- a/integration-tests/guice3/pom.xml
+++ b/integration-tests/guice3/pom.xml
@@ -91,7 +91,6 @@
         <dependency>
             <groupId>net.sourceforge.htmlunit</groupId>
             <artifactId>htmlunit</artifactId>
-            <version>2.6</version>
             <scope>test</scope>
         </dependency>
         <dependency>
@@ -108,9 +107,9 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>com.github.mjeanroy</groupId>
-            <artifactId>junit-servers-jetty</artifactId>
-            <scope>test</scope>
+            <groupId>org.apache.shiro.integrationtests</groupId>
+            <artifactId>shiro-its-support</artifactId>
+			<scope>test</scope>
         </dependency>
 	</dependencies>
 

http://git-wip-us.apache.org/repos/asf/shiro/blob/f9688b27/integration-tests/guice3/src/test/java/org/apache/shiro/samples/guice/AbstractContainerIT.java
----------------------------------------------------------------------
diff --git a/integration-tests/guice3/src/test/java/org/apache/shiro/samples/guice/AbstractContainerIT.java b/integration-tests/guice3/src/test/java/org/apache/shiro/samples/guice/AbstractContainerIT.java
deleted file mode 100644
index dcd47e1..0000000
--- a/integration-tests/guice3/src/test/java/org/apache/shiro/samples/guice/AbstractContainerIT.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * 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.apache.shiro.samples.guice;
-
-import com.gargoylesoftware.htmlunit.WebClient;
-import com.github.mjeanroy.junit.servers.jetty.EmbeddedJetty;
-import com.github.mjeanroy.junit.servers.jetty.EmbeddedJettyConfiguration;
-import org.eclipse.jetty.annotations.AnnotationConfiguration;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.util.resource.FileResource;
-import org.eclipse.jetty.webapp.Configuration;
-import org.eclipse.jetty.webapp.FragmentConfiguration;
-import org.eclipse.jetty.webapp.JettyWebXmlConfiguration;
-import org.eclipse.jetty.webapp.MetaInfConfiguration;
-import org.eclipse.jetty.webapp.WebAppContext;
-import org.eclipse.jetty.webapp.WebInfConfiguration;
-import org.eclipse.jetty.webapp.WebXmlConfiguration;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-
-import java.io.File;
-import java.io.FilenameFilter;
-
-import static com.github.mjeanroy.junit.servers.commons.Strings.isNotBlank;
-import static org.eclipse.jetty.util.resource.Resource.newResource;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-public abstract class AbstractContainerIT {
-
-    protected static EmbeddedJetty jetty;
-
-    protected final WebClient webClient = new WebClient();
-
-    @BeforeClass
-    public static void startContainer() throws Exception {
-
-        EmbeddedJettyConfiguration config = EmbeddedJettyConfiguration.builder()
-                .withWebapp(getWarDir())
-                .build();
-
-        jetty = new EmbeddedJetty(config) {
-
-            /**
-             * Overriding with contents of this pull request, to make fragment scanning work.
-             * https://github.com/mjeanroy/junit-servers/pull/3
-             */
-            protected WebAppContext createdWebAppContext() throws Exception {
-                final String path = configuration.getPath();
-                final String webapp = configuration.getWebapp();
-                final String classpath = configuration.getClasspath();
-
-                WebAppContext ctx = new WebAppContext();
-                ctx.setClassLoader(Thread.currentThread().getContextClassLoader());
-                ctx.setContextPath(path);
-
-                // Useful for WebXmlConfiguration
-                ctx.setBaseResource(newResource(webapp));
-
-                ctx.setConfigurations(new Configuration[]{
-                        new WebInfConfiguration(),
-                        new WebXmlConfiguration(),
-                        new AnnotationConfiguration(),
-                        new JettyWebXmlConfiguration(),
-                        new MetaInfConfiguration(),
-                        new FragmentConfiguration(),
-                });
-
-                if (isNotBlank(classpath)) {
-                    // Fix to scan Spring WebApplicationInitializer
-                    // This will add compiled classes to jetty classpath
-                    // See: http://stackoverflow.com/questions/13222071/spring-3-1-webapplicationinitializer-embedded-jetty-8-annotationconfiguration
-                    // And more precisely: http://stackoverflow.com/a/18449506/1215828
-                    File classes = new File(classpath);
-                    FileResource containerResources = new FileResource(classes.toURI());
-                    ctx.getMetaData().addContainerResource(containerResources);
-                }
-
-                Server server = getDelegate();
-
-                ctx.setParentLoaderPriority(true);
-                ctx.setWar(webapp);
-                ctx.setServer(server);
-
-                // Add server context
-                server.setHandler(ctx);
-
-                return ctx;
-            }
-        };
-
-        jetty.start();
-
-        assertTrue(jetty.isStarted());
-    }
-
-    protected static String getBaseUri() {
-        return "http://localhost:" + jetty.getPort() + "/";
-    }
-
-    protected static String getWarDir() {
-        File[] warFiles = new File("target").listFiles(new FilenameFilter() {
-            @Override
-            public boolean accept(File dir, String name) {
-                return name.endsWith(".war");
-            }
-        });
-
-        assertEquals("Expected only one war file in target directory, run 'mvn clean' and try again", 1, warFiles.length);
-
-        return warFiles[0].getAbsolutePath().replaceFirst("\\.war$", "");
-    }
-
-    @Before
-    public void beforeTest() {
-        webClient.setThrowExceptionOnFailingStatusCode(true);
-    }
-
-    @AfterClass
-    public static void stopContainer() {
-        if (jetty != null) {
-            jetty.stop();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/shiro/blob/f9688b27/integration-tests/guice3/src/test/java/org/apache/shiro/samples/guice/ContainerIntegrationIT.java
----------------------------------------------------------------------
diff --git a/integration-tests/guice3/src/test/java/org/apache/shiro/samples/guice/ContainerIntegrationIT.java b/integration-tests/guice3/src/test/java/org/apache/shiro/samples/guice/ContainerIntegrationIT.java
index 4ebc6c7..1288c84 100644
--- a/integration-tests/guice3/src/test/java/org/apache/shiro/samples/guice/ContainerIntegrationIT.java
+++ b/integration-tests/guice3/src/test/java/org/apache/shiro/samples/guice/ContainerIntegrationIT.java
@@ -18,6 +18,8 @@
  */
 package org.apache.shiro.samples.guice;
 
+import org.apache.shiro.testing.web.AbstractContainerIT;
+
 import com.gargoylesoftware.htmlunit.ElementNotFoundException;
 import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
 import com.gargoylesoftware.htmlunit.WebAssert;

http://git-wip-us.apache.org/repos/asf/shiro/blob/f9688b27/integration-tests/guice4/pom.xml
----------------------------------------------------------------------
diff --git a/integration-tests/guice4/pom.xml b/integration-tests/guice4/pom.xml
index da761ce..0abad4f 100644
--- a/integration-tests/guice4/pom.xml
+++ b/integration-tests/guice4/pom.xml
@@ -105,7 +105,6 @@
         <dependency>
             <groupId>net.sourceforge.htmlunit</groupId>
             <artifactId>htmlunit</artifactId>
-            <version>2.6</version>
             <scope>test</scope>
         </dependency>
         <dependency>
@@ -122,8 +121,8 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>com.github.mjeanroy</groupId>
-            <artifactId>junit-servers-jetty</artifactId>
+            <groupId>org.apache.shiro.integrationtests</groupId>
+            <artifactId>shiro-its-support</artifactId>
             <scope>test</scope>
         </dependency>
 	</dependencies>

http://git-wip-us.apache.org/repos/asf/shiro/blob/f9688b27/integration-tests/guice4/src/test/java/org/apache/shiro/samples/guice/AbstractContainerIT.java
----------------------------------------------------------------------
diff --git a/integration-tests/guice4/src/test/java/org/apache/shiro/samples/guice/AbstractContainerIT.java b/integration-tests/guice4/src/test/java/org/apache/shiro/samples/guice/AbstractContainerIT.java
deleted file mode 100644
index dcd47e1..0000000
--- a/integration-tests/guice4/src/test/java/org/apache/shiro/samples/guice/AbstractContainerIT.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * 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.apache.shiro.samples.guice;
-
-import com.gargoylesoftware.htmlunit.WebClient;
-import com.github.mjeanroy.junit.servers.jetty.EmbeddedJetty;
-import com.github.mjeanroy.junit.servers.jetty.EmbeddedJettyConfiguration;
-import org.eclipse.jetty.annotations.AnnotationConfiguration;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.util.resource.FileResource;
-import org.eclipse.jetty.webapp.Configuration;
-import org.eclipse.jetty.webapp.FragmentConfiguration;
-import org.eclipse.jetty.webapp.JettyWebXmlConfiguration;
-import org.eclipse.jetty.webapp.MetaInfConfiguration;
-import org.eclipse.jetty.webapp.WebAppContext;
-import org.eclipse.jetty.webapp.WebInfConfiguration;
-import org.eclipse.jetty.webapp.WebXmlConfiguration;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-
-import java.io.File;
-import java.io.FilenameFilter;
-
-import static com.github.mjeanroy.junit.servers.commons.Strings.isNotBlank;
-import static org.eclipse.jetty.util.resource.Resource.newResource;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-public abstract class AbstractContainerIT {
-
-    protected static EmbeddedJetty jetty;
-
-    protected final WebClient webClient = new WebClient();
-
-    @BeforeClass
-    public static void startContainer() throws Exception {
-
-        EmbeddedJettyConfiguration config = EmbeddedJettyConfiguration.builder()
-                .withWebapp(getWarDir())
-                .build();
-
-        jetty = new EmbeddedJetty(config) {
-
-            /**
-             * Overriding with contents of this pull request, to make fragment scanning work.
-             * https://github.com/mjeanroy/junit-servers/pull/3
-             */
-            protected WebAppContext createdWebAppContext() throws Exception {
-                final String path = configuration.getPath();
-                final String webapp = configuration.getWebapp();
-                final String classpath = configuration.getClasspath();
-
-                WebAppContext ctx = new WebAppContext();
-                ctx.setClassLoader(Thread.currentThread().getContextClassLoader());
-                ctx.setContextPath(path);
-
-                // Useful for WebXmlConfiguration
-                ctx.setBaseResource(newResource(webapp));
-
-                ctx.setConfigurations(new Configuration[]{
-                        new WebInfConfiguration(),
-                        new WebXmlConfiguration(),
-                        new AnnotationConfiguration(),
-                        new JettyWebXmlConfiguration(),
-                        new MetaInfConfiguration(),
-                        new FragmentConfiguration(),
-                });
-
-                if (isNotBlank(classpath)) {
-                    // Fix to scan Spring WebApplicationInitializer
-                    // This will add compiled classes to jetty classpath
-                    // See: http://stackoverflow.com/questions/13222071/spring-3-1-webapplicationinitializer-embedded-jetty-8-annotationconfiguration
-                    // And more precisely: http://stackoverflow.com/a/18449506/1215828
-                    File classes = new File(classpath);
-                    FileResource containerResources = new FileResource(classes.toURI());
-                    ctx.getMetaData().addContainerResource(containerResources);
-                }
-
-                Server server = getDelegate();
-
-                ctx.setParentLoaderPriority(true);
-                ctx.setWar(webapp);
-                ctx.setServer(server);
-
-                // Add server context
-                server.setHandler(ctx);
-
-                return ctx;
-            }
-        };
-
-        jetty.start();
-
-        assertTrue(jetty.isStarted());
-    }
-
-    protected static String getBaseUri() {
-        return "http://localhost:" + jetty.getPort() + "/";
-    }
-
-    protected static String getWarDir() {
-        File[] warFiles = new File("target").listFiles(new FilenameFilter() {
-            @Override
-            public boolean accept(File dir, String name) {
-                return name.endsWith(".war");
-            }
-        });
-
-        assertEquals("Expected only one war file in target directory, run 'mvn clean' and try again", 1, warFiles.length);
-
-        return warFiles[0].getAbsolutePath().replaceFirst("\\.war$", "");
-    }
-
-    @Before
-    public void beforeTest() {
-        webClient.setThrowExceptionOnFailingStatusCode(true);
-    }
-
-    @AfterClass
-    public static void stopContainer() {
-        if (jetty != null) {
-            jetty.stop();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/shiro/blob/f9688b27/integration-tests/guice4/src/test/java/org/apache/shiro/samples/guice/ContainerIntegrationIT.java
----------------------------------------------------------------------
diff --git a/integration-tests/guice4/src/test/java/org/apache/shiro/samples/guice/ContainerIntegrationIT.java b/integration-tests/guice4/src/test/java/org/apache/shiro/samples/guice/ContainerIntegrationIT.java
index 4ebc6c7..1288c84 100644
--- a/integration-tests/guice4/src/test/java/org/apache/shiro/samples/guice/ContainerIntegrationIT.java
+++ b/integration-tests/guice4/src/test/java/org/apache/shiro/samples/guice/ContainerIntegrationIT.java
@@ -18,6 +18,8 @@
  */
 package org.apache.shiro.samples.guice;
 
+import org.apache.shiro.testing.web.AbstractContainerIT;
+
 import com.gargoylesoftware.htmlunit.ElementNotFoundException;
 import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
 import com.gargoylesoftware.htmlunit.WebAssert;

http://git-wip-us.apache.org/repos/asf/shiro/blob/f9688b27/integration-tests/pom.xml
----------------------------------------------------------------------
diff --git a/integration-tests/pom.xml b/integration-tests/pom.xml
index 1b8dd19..2f94436 100644
--- a/integration-tests/pom.xml
+++ b/integration-tests/pom.xml
@@ -34,6 +34,7 @@
     <packaging>pom</packaging>
 
     <modules>
+        <module>support</module>
         <module>guice3</module>
         <module>guice4</module>
     </modules>

http://git-wip-us.apache.org/repos/asf/shiro/blob/f9688b27/integration-tests/support/pom.xml
----------------------------------------------------------------------
diff --git a/integration-tests/support/pom.xml b/integration-tests/support/pom.xml
new file mode 100644
index 0000000..13901fe
--- /dev/null
+++ b/integration-tests/support/pom.xml
@@ -0,0 +1,96 @@
+<?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.
+  -->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+
+	<parent>
+		<groupId>org.apache.shiro.integrationtests</groupId>
+		<artifactId>shiro-integration-tests</artifactId>
+		<version>1.4.0-SNAPSHOT</version>
+	</parent>
+
+	<artifactId>shiro-its-support</artifactId>
+	<name>Apache Shiro :: ITs :: Support</name>
+
+	<dependencies>
+	    <dependency>
+	        <groupId>javax.servlet</groupId>
+	        <artifactId>jstl</artifactId>
+			<scope>compile</scope>
+	    </dependency>
+	    <dependency>
+	        <groupId>javax.servlet</groupId>
+	        <artifactId>javax.servlet-api</artifactId>
+	        <scope>provided</scope>
+	    </dependency>
+	    <dependency>
+	        <groupId>org.slf4j</groupId>
+	        <artifactId>slf4j-log4j12</artifactId>
+	        <scope>runtime</scope>
+	    </dependency>
+	    <dependency>
+	        <groupId>log4j</groupId>
+	        <artifactId>log4j</artifactId>
+	        <scope>runtime</scope>
+	    </dependency>
+
+	    <dependency>
+	        <groupId>org.slf4j</groupId>
+	        <artifactId>jcl-over-slf4j</artifactId>
+	        <scope>runtime</scope>
+	    </dependency>
+
+        <dependency>
+            <groupId>net.sourceforge.htmlunit</groupId>
+            <artifactId>htmlunit</artifactId>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>apache-jsp</artifactId>
+            <version>${jetty.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>apache-jstl</artifactId>
+            <version>${jetty.version}</version>
+            <type>pom</type>
+        </dependency>
+        <dependency>
+            <groupId>com.github.mjeanroy</groupId>
+            <artifactId>junit-servers-jetty</artifactId>
+        </dependency>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<scope>compile</scope>
+		</dependency>
+
+		<!-- dependency on the Base64 class
+		     in 2.0 this is split out, so this dep will be removed
+		     in the future
+		 -->
+		<dependency>
+			<groupId>org.apache.shiro</groupId>
+			<artifactId>shiro-core</artifactId>
+		</dependency>
+
+	</dependencies>
+
+</project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/shiro/blob/f9688b27/integration-tests/support/src/main/java/org/apache/shiro/testing/web/AbstractContainerIT.java
----------------------------------------------------------------------
diff --git a/integration-tests/support/src/main/java/org/apache/shiro/testing/web/AbstractContainerIT.java b/integration-tests/support/src/main/java/org/apache/shiro/testing/web/AbstractContainerIT.java
new file mode 100644
index 0000000..5d3fcc0
--- /dev/null
+++ b/integration-tests/support/src/main/java/org/apache/shiro/testing/web/AbstractContainerIT.java
@@ -0,0 +1,153 @@
+/*
+ * 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.apache.shiro.testing.web;
+
+import org.apache.shiro.codec.Base64;
+
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.github.mjeanroy.junit.servers.jetty.EmbeddedJetty;
+import com.github.mjeanroy.junit.servers.jetty.EmbeddedJettyConfiguration;
+import org.eclipse.jetty.annotations.AnnotationConfiguration;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.util.resource.FileResource;
+import org.eclipse.jetty.webapp.Configuration;
+import org.eclipse.jetty.webapp.FragmentConfiguration;
+import org.eclipse.jetty.webapp.JettyWebXmlConfiguration;
+import org.eclipse.jetty.webapp.MetaInfConfiguration;
+import org.eclipse.jetty.webapp.WebAppContext;
+import org.eclipse.jetty.webapp.WebInfConfiguration;
+import org.eclipse.jetty.webapp.WebXmlConfiguration;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+
+import java.io.File;
+import java.io.FilenameFilter;
+import java.io.UnsupportedEncodingException;
+
+import static com.github.mjeanroy.junit.servers.commons.Strings.isNotBlank;
+import static org.eclipse.jetty.util.resource.Resource.newResource;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertTrue;
+
+public abstract class AbstractContainerIT {
+
+    protected static EmbeddedJetty jetty;
+
+    protected final WebClient webClient = new WebClient();
+
+    @BeforeClass
+    public static void startContainer() throws Exception {
+
+        EmbeddedJettyConfiguration config = EmbeddedJettyConfiguration.builder()
+                .withWebapp(getWarDir())
+                .build();
+
+        jetty = new EmbeddedJetty(config) {
+
+            /**
+             * Overriding with contents of this pull request, to make fragment scanning work.
+             * https://github.com/mjeanroy/junit-servers/pull/3
+             */
+            protected WebAppContext createdWebAppContext() throws Exception {
+                final String path = configuration.getPath();
+                final String webapp = configuration.getWebapp();
+                final String classpath = configuration.getClasspath();
+
+                WebAppContext ctx = new WebAppContext();
+                ctx.setClassLoader(Thread.currentThread().getContextClassLoader());
+                ctx.setContextPath(path);
+
+                // Useful for WebXmlConfiguration
+                ctx.setBaseResource(newResource(webapp));
+
+                ctx.setConfigurations(new Configuration[]{
+                        new WebInfConfiguration(),
+                        new WebXmlConfiguration(),
+                        new AnnotationConfiguration(),
+                        new JettyWebXmlConfiguration(),
+                        new MetaInfConfiguration(),
+                        new FragmentConfiguration(),
+                });
+
+                if (isNotBlank(classpath)) {
+                    // Fix to scan Spring WebApplicationInitializer
+                    // This will add compiled classes to jetty classpath
+                    // See: http://stackoverflow.com/questions/13222071/spring-3-1-webapplicationinitializer-embedded-jetty-8-annotationconfiguration
+                    // And more precisely: http://stackoverflow.com/a/18449506/1215828
+                    File classes = new File(classpath);
+                    FileResource containerResources = new FileResource(classes.toURI());
+                    ctx.getMetaData().addContainerResource(containerResources);
+                }
+
+                Server server = getDelegate();
+
+                ctx.setParentLoaderPriority(true);
+                ctx.setWar(webapp);
+                ctx.setServer(server);
+
+                // Add server context
+                server.setHandler(ctx);
+
+                return ctx;
+            }
+        };
+
+        jetty.start();
+
+        assertTrue(jetty.isStarted());
+    }
+
+    protected static String getBaseUri() {
+        return "http://localhost:" + jetty.getPort() + "/";
+    }
+
+    protected static String getWarDir() {
+        File[] warFiles = new File("target").listFiles(new FilenameFilter() {
+            @Override
+            public boolean accept(File dir, String name) {
+                return name.endsWith(".war");
+            }
+        });
+
+        assertEquals("Expected only one war file in target directory, run 'mvn clean' and try again", 1, warFiles.length);
+
+        return warFiles[0].getAbsolutePath().replaceFirst("\\.war$", "");
+    }
+
+    protected static String getBasicAuthorizationHeaderValue(String username, String password) throws UnsupportedEncodingException {
+        String authorizationHeader = username + ":" + password;
+        byte[] valueBytes;
+        valueBytes = authorizationHeader.getBytes("UTF-8");
+        authorizationHeader = new String(Base64.encode(valueBytes));
+        return "Basic " + authorizationHeader;
+    }
+
+    @Before
+    public void beforeTest() {
+        webClient.getOptions().setThrowExceptionOnFailingStatusCode(true);
+    }
+
+    @AfterClass
+    public static void stopContainer() {
+        if (jetty != null) {
+            jetty.stop();
+        }
+    }
+}

http://git-wip-us.apache.org/repos/asf/shiro/blob/f9688b27/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 0127e14..a6acd76 100644
--- a/pom.xml
+++ b/pom.xml
@@ -565,7 +565,6 @@
         <dependency>
             <groupId>junit</groupId>
             <artifactId>junit</artifactId>
-            <version>${junit.version}</version>
             <scope>test</scope>
         </dependency>
         <dependency>
@@ -683,8 +682,19 @@
                 <type>test-jar</type>
                 <scope>test</scope>
             </dependency>
+            <dependency>
+                <groupId>org.apache.shiro.integrationtests</groupId>
+                <artifactId>shiro-its-support</artifactId>
+                <version>1.4.0-SNAPSHOT</version>
+            </dependency>
 
             <!-- 3rd party dependencies -->
+
+            <dependency>
+                <groupId>junit</groupId>
+                <artifactId>junit</artifactId>
+                <version>${junit.version}</version>
+            </dependency>
             <dependency>
                 <!-- used for the 'hasher' command line tool: -->
                 <groupId>commons-cli</groupId>
@@ -841,6 +851,11 @@
                 <version>3.7.2</version>
             </dependency>
             <dependency>
+                <groupId>net.sourceforge.htmlunit</groupId>
+                <artifactId>htmlunit</artifactId>
+                <version>2.23</version>
+            </dependency>
+            <dependency>
                 <!-- Used for sample applications only - not required for the framework: -->
                 <groupId>org.hibernate</groupId>
                 <artifactId>hibernate</artifactId>
@@ -1031,7 +1046,6 @@
                 <groupId>com.github.mjeanroy</groupId>
                 <artifactId>junit-servers-jetty</artifactId>
                 <version>0.4.2</version>
-                <scope>test</scope>
             </dependency>
         </dependencies>
     </dependencyManagement>

http://git-wip-us.apache.org/repos/asf/shiro/blob/f9688b27/samples/guice/pom.xml
----------------------------------------------------------------------
diff --git a/samples/guice/pom.xml b/samples/guice/pom.xml
index e51c0e0..0297c7d 100644
--- a/samples/guice/pom.xml
+++ b/samples/guice/pom.xml
@@ -85,7 +85,6 @@
         <dependency>
             <groupId>net.sourceforge.htmlunit</groupId>
             <artifactId>htmlunit</artifactId>
-            <version>2.6</version>
             <scope>test</scope>
         </dependency>
         <dependency>
@@ -101,12 +100,12 @@
             <type>pom</type>
             <scope>test</scope>
         </dependency>
-        <dependency>
-            <groupId>com.github.mjeanroy</groupId>
-            <artifactId>junit-servers-jetty</artifactId>
-            <version>0.4.2</version>
-            <scope>test</scope>
-        </dependency>
+
+		<dependency>
+			<groupId>org.apache.shiro.integrationtests</groupId>
+			<artifactId>shiro-its-support</artifactId>
+			<scope>test</scope>
+		</dependency>
 	</dependencies>
 
 </project>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/shiro/blob/f9688b27/samples/guice/src/test/java/org/apache/shiro/samples/guice/AbstractContainerIT.java
----------------------------------------------------------------------
diff --git a/samples/guice/src/test/java/org/apache/shiro/samples/guice/AbstractContainerIT.java b/samples/guice/src/test/java/org/apache/shiro/samples/guice/AbstractContainerIT.java
deleted file mode 100644
index dcd47e1..0000000
--- a/samples/guice/src/test/java/org/apache/shiro/samples/guice/AbstractContainerIT.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
- * 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.apache.shiro.samples.guice;
-
-import com.gargoylesoftware.htmlunit.WebClient;
-import com.github.mjeanroy.junit.servers.jetty.EmbeddedJetty;
-import com.github.mjeanroy.junit.servers.jetty.EmbeddedJettyConfiguration;
-import org.eclipse.jetty.annotations.AnnotationConfiguration;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.util.resource.FileResource;
-import org.eclipse.jetty.webapp.Configuration;
-import org.eclipse.jetty.webapp.FragmentConfiguration;
-import org.eclipse.jetty.webapp.JettyWebXmlConfiguration;
-import org.eclipse.jetty.webapp.MetaInfConfiguration;
-import org.eclipse.jetty.webapp.WebAppContext;
-import org.eclipse.jetty.webapp.WebInfConfiguration;
-import org.eclipse.jetty.webapp.WebXmlConfiguration;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-
-import java.io.File;
-import java.io.FilenameFilter;
-
-import static com.github.mjeanroy.junit.servers.commons.Strings.isNotBlank;
-import static org.eclipse.jetty.util.resource.Resource.newResource;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-public abstract class AbstractContainerIT {
-
-    protected static EmbeddedJetty jetty;
-
-    protected final WebClient webClient = new WebClient();
-
-    @BeforeClass
-    public static void startContainer() throws Exception {
-
-        EmbeddedJettyConfiguration config = EmbeddedJettyConfiguration.builder()
-                .withWebapp(getWarDir())
-                .build();
-
-        jetty = new EmbeddedJetty(config) {
-
-            /**
-             * Overriding with contents of this pull request, to make fragment scanning work.
-             * https://github.com/mjeanroy/junit-servers/pull/3
-             */
-            protected WebAppContext createdWebAppContext() throws Exception {
-                final String path = configuration.getPath();
-                final String webapp = configuration.getWebapp();
-                final String classpath = configuration.getClasspath();
-
-                WebAppContext ctx = new WebAppContext();
-                ctx.setClassLoader(Thread.currentThread().getContextClassLoader());
-                ctx.setContextPath(path);
-
-                // Useful for WebXmlConfiguration
-                ctx.setBaseResource(newResource(webapp));
-
-                ctx.setConfigurations(new Configuration[]{
-                        new WebInfConfiguration(),
-                        new WebXmlConfiguration(),
-                        new AnnotationConfiguration(),
-                        new JettyWebXmlConfiguration(),
-                        new MetaInfConfiguration(),
-                        new FragmentConfiguration(),
-                });
-
-                if (isNotBlank(classpath)) {
-                    // Fix to scan Spring WebApplicationInitializer
-                    // This will add compiled classes to jetty classpath
-                    // See: http://stackoverflow.com/questions/13222071/spring-3-1-webapplicationinitializer-embedded-jetty-8-annotationconfiguration
-                    // And more precisely: http://stackoverflow.com/a/18449506/1215828
-                    File classes = new File(classpath);
-                    FileResource containerResources = new FileResource(classes.toURI());
-                    ctx.getMetaData().addContainerResource(containerResources);
-                }
-
-                Server server = getDelegate();
-
-                ctx.setParentLoaderPriority(true);
-                ctx.setWar(webapp);
-                ctx.setServer(server);
-
-                // Add server context
-                server.setHandler(ctx);
-
-                return ctx;
-            }
-        };
-
-        jetty.start();
-
-        assertTrue(jetty.isStarted());
-    }
-
-    protected static String getBaseUri() {
-        return "http://localhost:" + jetty.getPort() + "/";
-    }
-
-    protected static String getWarDir() {
-        File[] warFiles = new File("target").listFiles(new FilenameFilter() {
-            @Override
-            public boolean accept(File dir, String name) {
-                return name.endsWith(".war");
-            }
-        });
-
-        assertEquals("Expected only one war file in target directory, run 'mvn clean' and try again", 1, warFiles.length);
-
-        return warFiles[0].getAbsolutePath().replaceFirst("\\.war$", "");
-    }
-
-    @Before
-    public void beforeTest() {
-        webClient.setThrowExceptionOnFailingStatusCode(true);
-    }
-
-    @AfterClass
-    public static void stopContainer() {
-        if (jetty != null) {
-            jetty.stop();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/shiro/blob/f9688b27/samples/guice/src/test/java/org/apache/shiro/samples/guice/ContainerIntegrationIT.java
----------------------------------------------------------------------
diff --git a/samples/guice/src/test/java/org/apache/shiro/samples/guice/ContainerIntegrationIT.java b/samples/guice/src/test/java/org/apache/shiro/samples/guice/ContainerIntegrationIT.java
index 4ebc6c7..579357e 100644
--- a/samples/guice/src/test/java/org/apache/shiro/samples/guice/ContainerIntegrationIT.java
+++ b/samples/guice/src/test/java/org/apache/shiro/samples/guice/ContainerIntegrationIT.java
@@ -25,6 +25,7 @@ import com.gargoylesoftware.htmlunit.html.HtmlCheckBoxInput;
 import com.gargoylesoftware.htmlunit.html.HtmlForm;
 import com.gargoylesoftware.htmlunit.html.HtmlInput;
 import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import org.apache.shiro.testing.web.AbstractContainerIT;
 import org.junit.Before;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/shiro/blob/f9688b27/samples/jaxrs/pom.xml
----------------------------------------------------------------------
diff --git a/samples/jaxrs/pom.xml b/samples/jaxrs/pom.xml
index ad3716e..da02fed 100644
--- a/samples/jaxrs/pom.xml
+++ b/samples/jaxrs/pom.xml
@@ -93,9 +93,8 @@
         </dependency>
 
         <dependency>
-            <groupId>com.github.mjeanroy</groupId>
-            <artifactId>junit-servers-jetty</artifactId>
-            <version>0.4.2</version>
+            <groupId>org.apache.shiro.integrationtests</groupId>
+            <artifactId>shiro-its-support</artifactId>
             <scope>test</scope>
         </dependency>
 

http://git-wip-us.apache.org/repos/asf/shiro/blob/f9688b27/samples/jaxrs/src/test/groovy/org/apache/shiro/web/jaxrs/ContainerIntegrationIT.groovy
----------------------------------------------------------------------
diff --git a/samples/jaxrs/src/test/groovy/org/apache/shiro/web/jaxrs/ContainerIntegrationIT.groovy b/samples/jaxrs/src/test/groovy/org/apache/shiro/web/jaxrs/ContainerIntegrationIT.groovy
index 6fb66c0..84899d7 100644
--- a/samples/jaxrs/src/test/groovy/org/apache/shiro/web/jaxrs/ContainerIntegrationIT.groovy
+++ b/samples/jaxrs/src/test/groovy/org/apache/shiro/web/jaxrs/ContainerIntegrationIT.groovy
@@ -18,6 +18,7 @@
  */
 package org.apache.shiro.web.jaxrs
 
+import org.apache.shiro.testing.web.AbstractContainerIT
 import org.junit.Test;
 
 import static com.jayway.restassured.RestAssured.*

http://git-wip-us.apache.org/repos/asf/shiro/blob/f9688b27/samples/jaxrs/src/test/java/org/apache/shiro/web/jaxrs/AbstractContainerIT.java
----------------------------------------------------------------------
diff --git a/samples/jaxrs/src/test/java/org/apache/shiro/web/jaxrs/AbstractContainerIT.java b/samples/jaxrs/src/test/java/org/apache/shiro/web/jaxrs/AbstractContainerIT.java
deleted file mode 100644
index 192f9e3..0000000
--- a/samples/jaxrs/src/test/java/org/apache/shiro/web/jaxrs/AbstractContainerIT.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * 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.apache.shiro.web.jaxrs;
-
-import com.github.mjeanroy.junit.servers.jetty.EmbeddedJetty;
-import com.github.mjeanroy.junit.servers.jetty.EmbeddedJettyConfiguration;
-import org.apache.shiro.codec.Base64;
-import org.eclipse.jetty.annotations.AnnotationConfiguration;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.util.resource.FileResource;
-import org.eclipse.jetty.webapp.Configuration;
-import org.eclipse.jetty.webapp.FragmentConfiguration;
-import org.eclipse.jetty.webapp.JettyWebXmlConfiguration;
-import org.eclipse.jetty.webapp.MetaInfConfiguration;
-import org.eclipse.jetty.webapp.WebAppContext;
-import org.eclipse.jetty.webapp.WebInfConfiguration;
-import org.eclipse.jetty.webapp.WebXmlConfiguration;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-
-import java.io.File;
-import java.io.FilenameFilter;
-import java.io.UnsupportedEncodingException;
-
-import static com.github.mjeanroy.junit.servers.commons.Strings.isNotBlank;
-import static org.eclipse.jetty.util.resource.Resource.newResource;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-public abstract class AbstractContainerIT {
-
-    private static EmbeddedJetty jetty;
-
-    private static int port = 0;
-
-    @BeforeClass
-    public static void startContainer() throws Exception {
-
-        EmbeddedJettyConfiguration config = EmbeddedJettyConfiguration.builder()
-                .withWebapp(getWarDir())
-                .build();
-
-        jetty = new EmbeddedJetty(config) {
-
-            /**
-             * Overriding with contents of this pull request, to make fragment scanning work.
-             * https://github.com/mjeanroy/junit-servers/pull/3
-             */
-            protected WebAppContext createdWebAppContext() throws Exception {
-                final String path = configuration.getPath();
-                final String webapp = configuration.getWebapp();
-                final String classpath = configuration.getClasspath();
-
-                WebAppContext ctx = new WebAppContext();
-                ctx.setClassLoader(Thread.currentThread().getContextClassLoader());
-                ctx.setContextPath(path);
-
-                // Useful for WebXmlConfiguration
-                ctx.setBaseResource(newResource(webapp));
-
-                ctx.setConfigurations(new Configuration[]{
-                        new WebInfConfiguration(),
-                        new WebXmlConfiguration(),
-                        new AnnotationConfiguration(),
-                        new JettyWebXmlConfiguration(),
-                        new MetaInfConfiguration(),
-                        new FragmentConfiguration(),
-                });
-
-                if (isNotBlank(classpath)) {
-                    // Fix to scan Spring WebApplicationInitializer
-                    // This will add compiled classes to jetty classpath
-                    // See: http://stackoverflow.com/questions/13222071/spring-3-1-webapplicationinitializer-embedded-jetty-8-annotationconfiguration
-                    // And more precisely: http://stackoverflow.com/a/18449506/1215828
-                    File classes = new File(classpath);
-                    FileResource containerResources = new FileResource(classes.toURI());
-                    ctx.getMetaData().addContainerResource(containerResources);
-                }
-
-                Server server = getDelegate();
-
-                ctx.setParentLoaderPriority(true);
-                ctx.setWar(webapp);
-                ctx.setServer(server);
-
-                // Add server context
-                server.setHandler(ctx);
-
-                return ctx;
-            }
-        };
-
-        jetty.start();
-        port = jetty.getPort();
-
-        assertTrue(jetty.isStarted());
-    }
-
-    protected static String getBaseUri() {
-        return "http://localhost:" + port + "/";
-    }
-
-    protected static String getWarDir() {
-        File[] warFiles = new File("target").listFiles(new FilenameFilter() {
-            @Override
-            public boolean accept(File dir, String name) {
-                return name.endsWith(".war");
-            }
-        });
-
-        assertEquals("Expected only one war file in target directory, run 'mvn clean' and try again", 1, warFiles.length);
-
-        return warFiles[0].getAbsolutePath().replaceFirst("\\.war$", "");
-    }
-
-    @AfterClass
-    public static void stopContainer() {
-        if (jetty != null) {
-            jetty.stop();
-        }
-    }
-
-    protected static String getBasicAuthorizationHeaderValue(String username, String password) throws UnsupportedEncodingException {
-        String authorizationHeader = username + ":" + password;
-        byte[] valueBytes;
-        valueBytes = authorizationHeader.getBytes("UTF-8");
-        authorizationHeader = new String(Base64.encode(valueBytes));
-        return "Basic " + authorizationHeader;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/shiro/blob/f9688b27/samples/servlet-plugin/pom.xml
----------------------------------------------------------------------
diff --git a/samples/servlet-plugin/pom.xml b/samples/servlet-plugin/pom.xml
index c03d4f1..95388d7 100644
--- a/samples/servlet-plugin/pom.xml
+++ b/samples/servlet-plugin/pom.xml
@@ -84,7 +84,6 @@
         <dependency>
             <groupId>net.sourceforge.htmlunit</groupId>
             <artifactId>htmlunit</artifactId>
-            <version>2.6</version>
             <scope>test</scope>
         </dependency>
         <dependency>
@@ -103,14 +102,13 @@
         <dependency>
             <groupId>com.github.mjeanroy</groupId>
             <artifactId>junit-servers-jetty</artifactId>
-            <version>0.4.2</version>
             <scope>test</scope>
         </dependency>
 
         <dependency>
-            <groupId>org.slf4j</groupId>
-            <artifactId>jcl-over-slf4j</artifactId>
-            <scope>runtime</scope>
+            <groupId>org.apache.shiro.integrationtests</groupId>
+            <artifactId>shiro-its-support</artifactId>
+            <scope>test</scope>
         </dependency>
     </dependencies>
 

http://git-wip-us.apache.org/repos/asf/shiro/blob/f9688b27/samples/servlet-plugin/src/test/java/org/apache/shiro/test/AbstractContainerIT.java
----------------------------------------------------------------------
diff --git a/samples/servlet-plugin/src/test/java/org/apache/shiro/test/AbstractContainerIT.java b/samples/servlet-plugin/src/test/java/org/apache/shiro/test/AbstractContainerIT.java
deleted file mode 100644
index da02a0b..0000000
--- a/samples/servlet-plugin/src/test/java/org/apache/shiro/test/AbstractContainerIT.java
+++ /dev/null
@@ -1,147 +0,0 @@
-/*
- * 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.apache.shiro.test;
-
-import com.gargoylesoftware.htmlunit.WebClient;
-
-import static org.eclipse.jetty.util.resource.Resource.newResource;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-import com.github.mjeanroy.junit.servers.jetty.EmbeddedJetty;
-import com.github.mjeanroy.junit.servers.jetty.EmbeddedJettyConfiguration;
-import org.eclipse.jetty.annotations.AnnotationConfiguration;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.util.resource.FileResource;
-import org.eclipse.jetty.webapp.Configuration;
-import org.eclipse.jetty.webapp.FragmentConfiguration;
-import org.eclipse.jetty.webapp.JettyWebXmlConfiguration;
-import org.eclipse.jetty.webapp.MetaInfConfiguration;
-import org.eclipse.jetty.webapp.WebAppContext;
-import org.eclipse.jetty.webapp.WebInfConfiguration;
-import org.eclipse.jetty.webapp.WebXmlConfiguration;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-
-import java.io.File;
-import java.io.FilenameFilter;
-
-import static com.github.mjeanroy.junit.servers.commons.Strings.isNotBlank;
-
-public abstract class AbstractContainerIT {
-
-    private static EmbeddedJetty jetty;
-
-    private static int port = 0;
-
-    protected final WebClient webClient = new WebClient();
-
-    @BeforeClass
-    public static void startContainer() throws Exception {
-
-        EmbeddedJettyConfiguration config = EmbeddedJettyConfiguration.builder()
-                .withWebapp(getWarDir())
-                .build();
-
-        jetty = new EmbeddedJetty(config) {
-
-            /**
-             * Overriding with contents of this pull request, to make fragment scanning work.
-             * https://github.com/mjeanroy/junit-servers/pull/3
-             */
-            protected WebAppContext createdWebAppContext() throws Exception {
-                final String path = configuration.getPath();
-                final String webapp = configuration.getWebapp();
-                final String classpath = configuration.getClasspath();
-
-                WebAppContext ctx = new WebAppContext();
-                ctx.setClassLoader(Thread.currentThread().getContextClassLoader());
-                ctx.setContextPath(path);
-
-                // Useful for WebXmlConfiguration
-                ctx.setBaseResource(newResource(webapp));
-
-                ctx.setConfigurations(new Configuration[]{
-                        new WebInfConfiguration(),
-                        new WebXmlConfiguration(),
-                        new AnnotationConfiguration(),
-                        new JettyWebXmlConfiguration(),
-                        new MetaInfConfiguration(),
-                        new FragmentConfiguration(),
-                });
-
-                if (isNotBlank(classpath)) {
-                    // Fix to scan Spring WebApplicationInitializer
-                    // This will add compiled classes to jetty classpath
-                    // See: http://stackoverflow.com/questions/13222071/spring-3-1-webapplicationinitializer-embedded-jetty-8-annotationconfiguration
-                    // And more precisely: http://stackoverflow.com/a/18449506/1215828
-                    File classes = new File(classpath);
-                    FileResource containerResources = new FileResource(classes.toURI());
-                    ctx.getMetaData().addContainerResource(containerResources);
-                }
-
-                Server server = getDelegate();
-
-                ctx.setParentLoaderPriority(true);
-                ctx.setWar(webapp);
-                ctx.setServer(server);
-
-                // Add server context
-                server.setHandler(ctx);
-
-                return ctx;
-            }
-        };
-
-        jetty.start();
-        port = jetty.getPort();
-
-        assertTrue(jetty.isStarted());
-    }
-
-    protected static String getBaseUri() {
-        return "http://localhost:" + port + "/";
-    }
-
-    protected static String getWarDir() {
-        File[] warFiles = new File("target").listFiles(new FilenameFilter() {
-            @Override
-            public boolean accept(File dir, String name) {
-                return name.endsWith(".war");
-            }
-        });
-
-        assertEquals("Expected only one war file in target directory, run 'mvn clean' and try again", 1, warFiles.length);
-
-        return warFiles[0].getAbsolutePath().replaceFirst("\\.war$", "");
-    }
-
-    @Before
-    public void beforeTest() {
-        webClient.setThrowExceptionOnFailingStatusCode(true);
-    }
-
-    @AfterClass
-    public static void stopContainer() {
-        if (jetty != null) {
-            jetty.stop();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/shiro/blob/f9688b27/samples/servlet-plugin/src/test/java/org/apache/shiro/test/ContainerIntegrationIT.java
----------------------------------------------------------------------
diff --git a/samples/servlet-plugin/src/test/java/org/apache/shiro/test/ContainerIntegrationIT.java b/samples/servlet-plugin/src/test/java/org/apache/shiro/test/ContainerIntegrationIT.java
index 4cef226..658415a 100644
--- a/samples/servlet-plugin/src/test/java/org/apache/shiro/test/ContainerIntegrationIT.java
+++ b/samples/servlet-plugin/src/test/java/org/apache/shiro/test/ContainerIntegrationIT.java
@@ -23,6 +23,7 @@ import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
 import com.gargoylesoftware.htmlunit.html.HtmlForm;
 import com.gargoylesoftware.htmlunit.html.HtmlInput;
 import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import org.apache.shiro.testing.web.AbstractContainerIT;
 import org.junit.Before;
 import org.junit.Test;
 

http://git-wip-us.apache.org/repos/asf/shiro/blob/f9688b27/samples/web/pom.xml
----------------------------------------------------------------------
diff --git a/samples/web/pom.xml b/samples/web/pom.xml
index 8d93a9a..aadce3c 100644
--- a/samples/web/pom.xml
+++ b/samples/web/pom.xml
@@ -85,7 +85,6 @@
         <dependency>
             <groupId>net.sourceforge.htmlunit</groupId>
             <artifactId>htmlunit</artifactId>
-            <version>2.6</version>
             <scope>test</scope>
         </dependency>
         <dependency>
@@ -101,13 +100,6 @@
             <artifactId>jcl-over-slf4j</artifactId>
             <scope>runtime</scope>
         </dependency>
-
-        <dependency>
-            <groupId>net.sourceforge.htmlunit</groupId>
-            <artifactId>htmlunit</artifactId>
-            <version>2.6</version>
-            <scope>test</scope>
-        </dependency>
         <dependency>
             <groupId>org.eclipse.jetty</groupId>
             <artifactId>apache-jsp</artifactId>
@@ -122,9 +114,8 @@
             <scope>test</scope>
         </dependency>
         <dependency>
-            <groupId>com.github.mjeanroy</groupId>
-            <artifactId>junit-servers-jetty</artifactId>
-            <version>0.4.2</version>
+            <groupId>org.apache.shiro.integrationtests</groupId>
+            <artifactId>shiro-its-support</artifactId>
             <scope>test</scope>
         </dependency>
 

http://git-wip-us.apache.org/repos/asf/shiro/blob/f9688b27/samples/web/src/test/java/org/apache/shiro/test/AbstractContainerIT.java
----------------------------------------------------------------------
diff --git a/samples/web/src/test/java/org/apache/shiro/test/AbstractContainerIT.java b/samples/web/src/test/java/org/apache/shiro/test/AbstractContainerIT.java
deleted file mode 100644
index 4e3e598..0000000
--- a/samples/web/src/test/java/org/apache/shiro/test/AbstractContainerIT.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * 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.apache.shiro.test;
-
-import com.gargoylesoftware.htmlunit.WebClient;
-import com.github.mjeanroy.junit.servers.jetty.EmbeddedJetty;
-import com.github.mjeanroy.junit.servers.jetty.EmbeddedJettyConfiguration;
-import org.eclipse.jetty.annotations.AnnotationConfiguration;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.util.resource.FileResource;
-import org.eclipse.jetty.webapp.Configuration;
-import org.eclipse.jetty.webapp.FragmentConfiguration;
-import org.eclipse.jetty.webapp.JettyWebXmlConfiguration;
-import org.eclipse.jetty.webapp.MetaInfConfiguration;
-import org.eclipse.jetty.webapp.WebAppContext;
-import org.eclipse.jetty.webapp.WebInfConfiguration;
-import org.eclipse.jetty.webapp.WebXmlConfiguration;
-import org.junit.AfterClass;
-import org.junit.Before;
-import org.junit.BeforeClass;
-
-import java.io.File;
-import java.io.FilenameFilter;
-
-import static com.github.mjeanroy.junit.servers.commons.Strings.isNotBlank;
-import static org.eclipse.jetty.util.resource.Resource.newResource;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertTrue;
-
-public abstract class AbstractContainerIT {
-
-    private static EmbeddedJetty jetty;
-
-    private static int port = 0;
-
-    protected final WebClient webClient = new WebClient();
-
-    @BeforeClass
-    public static void startContainer() throws Exception {
-
-        EmbeddedJettyConfiguration config = EmbeddedJettyConfiguration.builder()
-                .withWebapp(getWarDir())
-                .build();
-
-        jetty = new EmbeddedJetty(config) {
-
-            /**
-             * Overriding with contents of this pull request, to make fragment scanning work.
-             * https://github.com/mjeanroy/junit-servers/pull/3
-             */
-            protected WebAppContext createdWebAppContext() throws Exception {
-                final String path = configuration.getPath();
-                final String webapp = configuration.getWebapp();
-                final String classpath = configuration.getClasspath();
-
-                WebAppContext ctx = new WebAppContext();
-                ctx.setClassLoader(Thread.currentThread().getContextClassLoader());
-                ctx.setContextPath(path);
-
-                // Useful for WebXmlConfiguration
-                ctx.setBaseResource(newResource(webapp));
-
-                ctx.setConfigurations(new Configuration[]{
-                        new WebInfConfiguration(),
-                        new WebXmlConfiguration(),
-                        new AnnotationConfiguration(),
-                        new JettyWebXmlConfiguration(),
-                        new MetaInfConfiguration(),
-                        new FragmentConfiguration(),
-                });
-
-                if (isNotBlank(classpath)) {
-                    // Fix to scan Spring WebApplicationInitializer
-                    // This will add compiled classes to jetty classpath
-                    // See: http://stackoverflow.com/questions/13222071/spring-3-1-webapplicationinitializer-embedded-jetty-8-annotationconfiguration
-                    // And more precisely: http://stackoverflow.com/a/18449506/1215828
-                    File classes = new File(classpath);
-                    FileResource containerResources = new FileResource(classes.toURI());
-                    ctx.getMetaData().addContainerResource(containerResources);
-                }
-
-                Server server = getDelegate();
-
-                ctx.setParentLoaderPriority(true);
-                ctx.setWar(webapp);
-                ctx.setServer(server);
-
-                // Add server context
-                server.setHandler(ctx);
-
-                return ctx;
-            }
-        };
-
-        jetty.start();
-        port = jetty.getPort();
-
-        assertTrue(jetty.isStarted());
-    }
-
-    protected static String getBaseUri() {
-        return "http://localhost:" + port + "/";
-    }
-
-    protected static String getWarDir() {
-        File[] warFiles = new File("target").listFiles(new FilenameFilter() {
-            @Override
-            public boolean accept(File dir, String name) {
-                return name.endsWith(".war");
-            }
-        });
-
-        assertEquals("Expected only one war file in target directory, run 'mvn clean' and try again", 1, warFiles.length);
-
-        return warFiles[0].getAbsolutePath().replaceFirst("\\.war$", "");
-    }
-
-    @Before
-    public void beforeTest() {
-        webClient.setThrowExceptionOnFailingStatusCode(true);
-    }
-
-    @AfterClass
-    public static void stopContainer() {
-        if (jetty != null) {
-            jetty.stop();
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/shiro/blob/f9688b27/samples/web/src/test/java/org/apache/shiro/test/ContainerIntegrationIT.java
----------------------------------------------------------------------
diff --git a/samples/web/src/test/java/org/apache/shiro/test/ContainerIntegrationIT.java b/samples/web/src/test/java/org/apache/shiro/test/ContainerIntegrationIT.java
index cd5ae7f..d451748 100644
--- a/samples/web/src/test/java/org/apache/shiro/test/ContainerIntegrationIT.java
+++ b/samples/web/src/test/java/org/apache/shiro/test/ContainerIntegrationIT.java
@@ -24,6 +24,7 @@ import com.gargoylesoftware.htmlunit.WebClient;
 import com.gargoylesoftware.htmlunit.html.HtmlForm;
 import com.gargoylesoftware.htmlunit.html.HtmlInput;
 import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import org.apache.shiro.testing.web.AbstractContainerIT;
 import org.junit.Before;
 import org.junit.Test;
 


[4/9] shiro git commit: Revert "SHIRO-462 - Changing swallowed exceptions to log.warn instead of log.debug"

Posted by bd...@apache.org.
Revert "SHIRO-462 - Changing swallowed exceptions to log.warn instead of log.debug"

This reverts commit 88dd180506f3fb416fe5966c73571df0c9328e44.

Fixes: #41, SHIRO-592


Project: http://git-wip-us.apache.org/repos/asf/shiro/repo
Commit: http://git-wip-us.apache.org/repos/asf/shiro/commit/822cef59
Tree: http://git-wip-us.apache.org/repos/asf/shiro/tree/822cef59
Diff: http://git-wip-us.apache.org/repos/asf/shiro/diff/822cef59

Branch: refs/heads/1.4.x
Commit: 822cef59b3d2884865f88592eac8cfd107855f63
Parents: 0061bc4
Author: Brian Demers <bd...@apache.org>
Authored: Wed Oct 12 14:45:22 2016 -0400
Committer: Brian Demers <bd...@apache.org>
Committed: Wed Oct 19 14:46:50 2016 -0400

----------------------------------------------------------------------
 .../org/apache/shiro/authc/pam/ModularRealmAuthenticator.java    | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/shiro/blob/822cef59/core/src/main/java/org/apache/shiro/authc/pam/ModularRealmAuthenticator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/shiro/authc/pam/ModularRealmAuthenticator.java b/core/src/main/java/org/apache/shiro/authc/pam/ModularRealmAuthenticator.java
index 04e8e60..41ebe41 100644
--- a/core/src/main/java/org/apache/shiro/authc/pam/ModularRealmAuthenticator.java
+++ b/core/src/main/java/org/apache/shiro/authc/pam/ModularRealmAuthenticator.java
@@ -219,9 +219,9 @@ public class ModularRealmAuthenticator extends AbstractAuthenticator {
                     info = realm.getAuthenticationInfo(token);
                 } catch (Throwable throwable) {
                     t = throwable;
-                    if (log.isWarnEnabled()) {
+                    if (log.isDebugEnabled()) {
                         String msg = "Realm [" + realm + "] threw an exception during a multi-realm authentication attempt:";
-                        log.warn(msg, t);
+                        log.debug(msg, t);
                     }
                 }
 


[2/9] shiro git commit: SHIRO-576 Updated dependency beanutils to version 1.9.3 in order to get rid of CVE-2014-0114

Posted by bd...@apache.org.
SHIRO-576 Updated dependency beanutils to version 1.9.3 in order to get rid of CVE-2014-0114


Project: http://git-wip-us.apache.org/repos/asf/shiro/repo
Commit: http://git-wip-us.apache.org/repos/asf/shiro/commit/a85e2d78
Tree: http://git-wip-us.apache.org/repos/asf/shiro/tree/a85e2d78
Diff: http://git-wip-us.apache.org/repos/asf/shiro/diff/a85e2d78

Branch: refs/heads/1.4.x
Commit: a85e2d78baa3017dcf2b466434ba4dd68530a965
Parents: 2466e22
Author: schnatterer <jo...@schnatterer.info>
Authored: Mon Sep 26 22:33:46 2016 +0200
Committer: Brian Demers <bd...@apache.org>
Committed: Wed Oct 19 14:46:10 2016 -0400

----------------------------------------------------------------------
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/shiro/blob/a85e2d78/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index d667bda..0127e14 100644
--- a/pom.xml
+++ b/pom.xml
@@ -761,7 +761,7 @@
             <dependency>
                 <groupId>commons-beanutils</groupId>
                 <artifactId>commons-beanutils</artifactId>
-                <version>1.8.3</version>
+                <version>1.9.3</version>
                 <exclusions>
                     <exclusion>
                         <groupId>commons-logging</groupId>


[9/9] shiro git commit: SHIRO-595 - Allow for POST method only logouts via the LogoutFilter

Posted by bd...@apache.org.
SHIRO-595 - Allow for POST method only logouts via the LogoutFilter

Setting 'shiro.postOnlyLogout' to false will restrict logout requests to only POST requests.


Project: http://git-wip-us.apache.org/repos/asf/shiro/repo
Commit: http://git-wip-us.apache.org/repos/asf/shiro/commit/921753e8
Tree: http://git-wip-us.apache.org/repos/asf/shiro/tree/921753e8
Diff: http://git-wip-us.apache.org/repos/asf/shiro/diff/921753e8

Branch: refs/heads/1.4.x
Commit: 921753e82de6b7e55277a3be378e68035eea3af5
Parents: 84685c6
Author: Brian Demers <bd...@apache.org>
Authored: Thu Oct 20 17:57:07 2016 -0400
Committer: Brian Demers <bd...@apache.org>
Committed: Fri Oct 21 10:15:45 2016 -0400

----------------------------------------------------------------------
 samples/web/src/main/webapp/WEB-INF/shiro.ini   |  1 +
 samples/web/src/main/webapp/account/index.jsp   |  4 +-
 samples/web/src/main/webapp/home.jsp            |  4 +-
 samples/web/src/main/webapp/logout.jsp          | 34 +++++++
 .../shiro/web/filter/authc/LogoutFilter.java    | 65 +++++++++++++
 .../web/filter/authc/LogoutFilterTest.groovy    | 99 ++++++++++++++++++++
 6 files changed, 203 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/shiro/blob/921753e8/samples/web/src/main/webapp/WEB-INF/shiro.ini
----------------------------------------------------------------------
diff --git a/samples/web/src/main/webapp/WEB-INF/shiro.ini b/samples/web/src/main/webapp/WEB-INF/shiro.ini
index 33c7586..f517f20 100644
--- a/samples/web/src/main/webapp/WEB-INF/shiro.ini
+++ b/samples/web/src/main/webapp/WEB-INF/shiro.ini
@@ -24,6 +24,7 @@
 listener = org.apache.shiro.config.event.LoggingBeanEventListener
 
 shiro.loginUrl = /login.jsp
+shiro.postOnlyLogout = true
 
 # We need to set the cipherKey, if you want the rememberMe cookie to work after restarting or on multiple nodes.
 # YOU MUST SET THIS TO A UNIQUE STRING

http://git-wip-us.apache.org/repos/asf/shiro/blob/921753e8/samples/web/src/main/webapp/account/index.jsp
----------------------------------------------------------------------
diff --git a/samples/web/src/main/webapp/account/index.jsp b/samples/web/src/main/webapp/account/index.jsp
index 4f6c9d8..489d5de 100644
--- a/samples/web/src/main/webapp/account/index.jsp
+++ b/samples/web/src/main/webapp/account/index.jsp
@@ -30,7 +30,7 @@
 
 <p><a href="<c:url value="/home.jsp"/>">Return to the home page.</a></p>
 
-<p><a href="<c:url value="/logout"/>">Log out.</a></p>
-
+<p><a href="<c:url value="/logout"/>" onclick="document.getElementById('logout_form').submit();return false;">Log out.</a></p>
+<form id="logout_form" action="<c:url value="/logout"/>" method="post"></form>
 </body>
 </html>
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/shiro/blob/921753e8/samples/web/src/main/webapp/home.jsp
----------------------------------------------------------------------
diff --git a/samples/web/src/main/webapp/home.jsp b/samples/web/src/main/webapp/home.jsp
index 61dee25..ae46cde 100644
--- a/samples/web/src/main/webapp/home.jsp
+++ b/samples/web/src/main/webapp/home.jsp
@@ -28,7 +28,7 @@
 <h1>Apache Shiro Quickstart</h1>
 
 <p>Hi <shiro:guest>Guest</shiro:guest><shiro:user><shiro:principal/></shiro:user>!
-    ( <shiro:user><a href="<c:url value="/logout"/>">Log out</a></shiro:user>
+    ( <shiro:user>  <a href="<c:url value="/logout"/>" onclick="document.getElementById('logout_form').submit();return false;">logout</a> </shiro:user>
     <shiro:guest><a href="<c:url value="/login.jsp"/>">Log in</a> (sample accounts provided)</shiro:guest> )
 </p>
 
@@ -64,6 +64,6 @@
     <shiro:lacksRole name="schwartz">schwartz<br/></shiro:lacksRole>
 </p>
 
-
+<form id="logout_form" action="<c:url value="/logout"/>" method="post"></form>
 </body>
 </html>

http://git-wip-us.apache.org/repos/asf/shiro/blob/921753e8/samples/web/src/main/webapp/logout.jsp
----------------------------------------------------------------------
diff --git a/samples/web/src/main/webapp/logout.jsp b/samples/web/src/main/webapp/logout.jsp
new file mode 100644
index 0000000..440ec1c
--- /dev/null
+++ b/samples/web/src/main/webapp/logout.jsp
@@ -0,0 +1,34 @@
+<%--
+  ~ 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.
+  --%>
+<%@ include file="include.jsp" %>
+
+<html>
+<head>
+    <link type="text/css" rel="stylesheet" href="<c:url value="/style.css"/>"/>
+</head>
+<body onload="document.getElementById('logout_form').submit();return false;">
+
+<h2>If you are not automatically redirected, click the 'Logout' button.</h2>
+
+<form id="logout_form" name="logout_form" action="<c:url value="/logout"/>" method="post">
+    <input type="submit" value="Logout">
+</form>
+
+</body>
+</html>

http://git-wip-us.apache.org/repos/asf/shiro/blob/921753e8/web/src/main/java/org/apache/shiro/web/filter/authc/LogoutFilter.java
----------------------------------------------------------------------
diff --git a/web/src/main/java/org/apache/shiro/web/filter/authc/LogoutFilter.java b/web/src/main/java/org/apache/shiro/web/filter/authc/LogoutFilter.java
index c0d695b..e1da70e 100644
--- a/web/src/main/java/org/apache/shiro/web/filter/authc/LogoutFilter.java
+++ b/web/src/main/java/org/apache/shiro/web/filter/authc/LogoutFilter.java
@@ -21,6 +21,7 @@ package org.apache.shiro.web.filter.authc;
 import org.apache.shiro.SecurityUtils;
 import org.apache.shiro.session.SessionException;
 import org.apache.shiro.subject.Subject;
+import org.apache.shiro.util.StringUtils;
 import org.apache.shiro.web.servlet.AdviceFilter;
 import org.apache.shiro.web.util.WebUtils;
 import org.slf4j.Logger;
@@ -28,6 +29,11 @@ import org.slf4j.LoggerFactory;
 
 import javax.servlet.ServletRequest;
 import javax.servlet.ServletResponse;
+import javax.servlet.http.HttpServletResponse;
+
+import java.util.Locale;
+
+import static org.apache.shiro.web.filter.mgt.DefaultFilter.logout;
 
 /**
  * Simple Filter that, upon receiving a request, will immediately log-out the currently executing
@@ -52,6 +58,13 @@ public class LogoutFilter extends AdviceFilter {
     private String redirectUrl = DEFAULT_REDIRECT_URL;
 
     /**
+     * Due to browser pre-fetching, using a GET requests for logout my cause a user to be logged accidentally, for example:
+     * out while typing in an address bar.  If <code>postOnlyLogout</code> is <code>true</code>. Only POST requests will cause
+     * a logout to occur.
+     */
+    private boolean postOnlyLogout = false;
+
+    /**
      * Acquires the currently executing {@link #getSubject(javax.servlet.ServletRequest, javax.servlet.ServletResponse) subject},
      * a potentially Subject or request-specific
      * {@link #getRedirectUrl(javax.servlet.ServletRequest, javax.servlet.ServletResponse, org.apache.shiro.subject.Subject) redirectUrl},
@@ -64,7 +77,18 @@ public class LogoutFilter extends AdviceFilter {
      */
     @Override
     protected boolean preHandle(ServletRequest request, ServletResponse response) throws Exception {
+
         Subject subject = getSubject(request, response);
+
+        // Check if POST only logout is enabled
+        if (isPostOnlyLogout()) {
+
+            // check if the current request's method is a POST, if not redirect
+            if (!WebUtils.toHttp(request).getMethod().toUpperCase(Locale.ENGLISH).equals("POST")) {
+               return onLogoutRequestNotAPost(request, response);
+            }
+        }
+
         String redirectUrl = getRedirectUrl(request, response, subject);
         //try/catch added for SHIRO-298:
         try {
@@ -140,7 +164,48 @@ public class LogoutFilter extends AdviceFilter {
      *
      * @param redirectUrl the url to where the user will be redirected after logout
      */
+    @SuppressWarnings("unused")
     public void setRedirectUrl(String redirectUrl) {
         this.redirectUrl = redirectUrl;
     }
+
+
+    /**
+     * This method is called when <code>postOnlyLogout</code> is <code>true</code>, and the request was NOT a <code>POST</code>.
+     * For example if this filter is bound to '/logout' and the caller makes a GET request, this method would be invoked.
+     * <p>
+     *     The default implementation sets the response code to a 405, and sets the 'Allow' header to 'POST', and
+     *     always returns false.
+     * </p>
+     *
+     * @return The return value indicates if the processing should continue in this filter chain.
+     */
+    protected boolean onLogoutRequestNotAPost(ServletRequest request, ServletResponse response) {
+
+        HttpServletResponse httpServletResponse = WebUtils.toHttp(response);
+        httpServletResponse.setStatus(HttpServletResponse.SC_METHOD_NOT_ALLOWED);
+        httpServletResponse.setHeader("Allow", "POST");
+        return false;
+    }
+
+    /**
+     * Due to browser pre-fetching, using a GET requests for logout my cause a user to be logged accidentally, for example:
+     * out while typing in an address bar.  If <code>postOnlyLogout</code> is <code>true</code>. Only POST requests will cause
+     * a logout to occur.
+     *
+     * @return Returns true if POST only logout is enabled
+     */
+    public boolean isPostOnlyLogout() {
+        return postOnlyLogout;
+    }
+
+    /**
+     * Due to browser pre-fetching, using a GET requests for logout my cause a user to be logged accidentally, for example:
+     * out while typing in an address bar.  If <code>postOnlyLogout</code> is <code>true</code>. Only POST requests will cause
+     * a logout to occur.
+     * @param postOnlyLogout enable or disable POST only logout.
+     */
+    public void setPostOnlyLogout(boolean postOnlyLogout) {
+        this.postOnlyLogout = postOnlyLogout;
+    }
 }

http://git-wip-us.apache.org/repos/asf/shiro/blob/921753e8/web/src/test/groovy/org/apache/shiro/web/filter/authc/LogoutFilterTest.groovy
----------------------------------------------------------------------
diff --git a/web/src/test/groovy/org/apache/shiro/web/filter/authc/LogoutFilterTest.groovy b/web/src/test/groovy/org/apache/shiro/web/filter/authc/LogoutFilterTest.groovy
new file mode 100644
index 0000000..ff861f0
--- /dev/null
+++ b/web/src/test/groovy/org/apache/shiro/web/filter/authc/LogoutFilterTest.groovy
@@ -0,0 +1,99 @@
+package org.apache.shiro.web.filter.authc
+
+import org.apache.shiro.subject.Subject
+import org.junit.Test
+
+import javax.servlet.ServletRequest
+import javax.servlet.ServletResponse
+import javax.servlet.http.HttpServletRequest
+import javax.servlet.http.HttpServletResponse
+
+import static org.easymock.EasyMock.*
+import static org.junit.Assert.*
+
+/**
+ * Tests for {@link LogoutFilterTest}.
+ */
+class LogoutFilterTest {
+
+    @Test
+    void testLogoutViaGetMethod() {
+
+        def request = mock(HttpServletRequest)
+        def response = mock(HttpServletResponse)
+        def subject = mock(Subject)
+
+        // expect
+        subject.logout()
+        expect(request.getContextPath()).andReturn("")
+        expect(response.encodeRedirectURL("/")).andReturn("/").anyTimes()
+        response.sendRedirect("/")
+
+        replay request, response, subject
+
+        def filter = new LogoutFilter() {
+            @Override
+            protected Subject getSubject(ServletRequest servletRequest, ServletResponse servletResponse) {
+                return subject
+            }
+        };
+
+        filter.preHandle(request, response)
+
+        verify request, response, subject
+    }
+
+    @Test
+    void testLogoutViaGetMethodWhenPostOnlyEnabled() {
+
+        def request = mock(HttpServletRequest)
+        def response = mock(HttpServletResponse)
+        def subject = mock(Subject)
+
+        // expect
+        expect(request.getMethod()).andReturn("GET")
+        expect(response.setStatus(405))
+        expect(response.setHeader("Allow", "POST"))
+
+        replay request, response, subject
+
+        def filter = new LogoutFilter() {
+            @Override
+            protected Subject getSubject(ServletRequest servletRequest, ServletResponse servletResponse) {
+                return subject
+            }
+        };
+        filter.setPostOnlyLogout(true)
+        filter.preHandle(request, response)
+
+        verify request, response, subject
+    }
+
+    @Test
+    void testLogoutViaPostMethodWhenPostOnlyEnabled() {
+
+        def request = mock(HttpServletRequest)
+        def response = mock(HttpServletResponse)
+        def subject = mock(Subject)
+
+        // expect
+        expect(request.getMethod()).andReturn("Post")
+        subject.logout()
+        expect(request.getContextPath()).andReturn("")
+        expect(response.encodeRedirectURL("/")).andReturn("/").anyTimes()
+        response.sendRedirect("/")
+
+        replay request, response, subject
+
+        def filter = new LogoutFilter() {
+            @Override
+            protected Subject getSubject(ServletRequest servletRequest, ServletResponse servletResponse) {
+                return subject
+            }
+        };
+        filter.setPostOnlyLogout(true)
+        filter.preHandle(request, response)
+
+        verify request, response, subject
+    }
+}


[8/9] shiro git commit: SHIRO-576 Added OWASP dependency check plugin

Posted by bd...@apache.org.
SHIRO-576 Added OWASP dependency check plugin

NOTE: this plugin config will return false positives, usage will require human interpretation (and should NOT be used to fail builds)


Project: http://git-wip-us.apache.org/repos/asf/shiro/repo
Commit: http://git-wip-us.apache.org/repos/asf/shiro/commit/84685c6d
Tree: http://git-wip-us.apache.org/repos/asf/shiro/tree/84685c6d
Diff: http://git-wip-us.apache.org/repos/asf/shiro/diff/84685c6d

Branch: refs/heads/1.4.x
Commit: 84685c6db20f5dbfc06c6d168a86877486b8b74b
Parents: 49c7193
Author: Brian Demers <bd...@apache.org>
Authored: Thu Oct 20 11:18:27 2016 -0400
Committer: Brian Demers <bd...@apache.org>
Committed: Thu Oct 20 11:18:27 2016 -0400

----------------------------------------------------------------------
 pom.xml                   | 51 ++++++++++++++++++++++++++++++++++++++++++
 src/owasp-suppression.xml | 22 ++++++++++++++++++
 2 files changed, 73 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/shiro/blob/84685c6d/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index af1d102..cfc31ee 100644
--- a/pom.xml
+++ b/pom.xml
@@ -405,6 +405,11 @@
                         </requestLog>
                     </configuration>
                 </plugin>
+                <plugin>
+                    <groupId>org.owasp</groupId>
+                    <artifactId>dependency-check-maven</artifactId>
+                    <version>1.4.3</version>
+                </plugin>
             </plugins>
         </pluginManagement>
         <plugins>
@@ -1262,5 +1267,51 @@
                 </site>
             </distributionManagement>
         </profile>
+        <profile>
+            <!--  NOTE: this plugin config will return false positives, usage will require
+                  human interpretation (and should NOT be used to fail builds)
+            -->
+            <id>owasp</id>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.owasp</groupId>
+                        <artifactId>dependency-check-maven</artifactId>
+                        <inherited>false</inherited>
+                        <configuration>
+                            <suppressionFile>${root.dir}/src/owasp-suppression.xml</suppressionFile>
+                        </configuration>
+                        <executions>
+                            <execution>
+                                <goals>
+                                    <goal>aggregate</goal>
+                                </goals>
+                                <inherited>false</inherited>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+            <reporting>
+                <plugins>
+                    <plugin>
+                        <groupId>org.owasp</groupId>
+                        <artifactId>dependency-check-maven</artifactId>
+                        <inherited>false</inherited>
+                        <configuration>
+                            <suppressionFile>${root.dir}/src/owasp-suppression.xml</suppressionFile>
+                            <name>OWASP Dependency Check</name>
+                        </configuration>
+                        <reportSets>
+                            <reportSet>
+                                <reports>
+                                    <report>aggregate</report>
+                                </reports>
+                            </reportSet>
+                        </reportSets>
+                    </plugin>
+                </plugins>
+            </reporting>
+        </profile>
     </profiles>
 </project>

http://git-wip-us.apache.org/repos/asf/shiro/blob/84685c6d/src/owasp-suppression.xml
----------------------------------------------------------------------
diff --git a/src/owasp-suppression.xml b/src/owasp-suppression.xml
new file mode 100644
index 0000000..1fb0ec4
--- /dev/null
+++ b/src/owasp-suppression.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<suppressions xmlns="https://jeremylong.github.io/DependencyCheck/dependency-suppression.1.1.xsd">
+
+    <suppress>
+        <notes><![CDATA[ file name: tomcat-embed-core-8.5.5.jar ]]></notes>
+        <sha1>d55e12a418ff99ecd723a118c2a28bb91079972d</sha1>
+        <cpe>cpe:/a:apache:tomcat:8.5.5</cpe>
+    </suppress>
+
+    <suppress>
+        <notes><![CDATA[ file name: tomcat-embed-websocket-8.5.5.jar ]]></notes>
+        <sha1>fd99cd1cd4c824abdf03466f0509f067747f0d1a</sha1>
+        <cpe>cpe:/a:apache:tomcat:8.5.5</cpe>
+    </suppress>
+
+    <suppress>
+        <notes><![CDATA[ file name: opensaml-1.1.jar ]]></notes>
+        <sha1>21ec22368b6baa211a29887e162aa4cf9a8f3c60</sha1>
+        <cpe>cpe:/a:internet2:opensaml:1.1</cpe>
+    </suppress>
+
+</suppressions>
\ No newline at end of file


[7/9] shiro git commit: Updated Spring hibernate example to use hibernate 4

Posted by bd...@apache.org.
Updated Spring hibernate example to use hibernate 4

Updated Spring to latest 3.x (3.2.17) and Spring boot to 1.4.1
Added basic IT for hibernate example


Project: http://git-wip-us.apache.org/repos/asf/shiro/repo
Commit: http://git-wip-us.apache.org/repos/asf/shiro/commit/49c71939
Tree: http://git-wip-us.apache.org/repos/asf/shiro/tree/49c71939
Diff: http://git-wip-us.apache.org/repos/asf/shiro/diff/49c71939

Branch: refs/heads/1.4.x
Commit: 49c71939b07dc7a9143a1204fabc6e991249c1e9
Parents: 29957a9
Author: Brian Demers <bd...@apache.org>
Authored: Thu Oct 20 11:14:25 2016 -0400
Committer: Brian Demers <bd...@apache.org>
Committed: Thu Oct 20 11:14:25 2016 -0400

----------------------------------------------------------------------
 pom.xml                                         | 11 +--
 samples/spring-hibernate/pom.xml                | 81 +++++++++-----------
 .../shiro/samples/sprhib/dao/HibernateDao.java  |  3 +-
 .../apache/shiro/samples/sprhib/model/Role.java |  2 +-
 .../main/webapp/WEB-INF/applicationContext.xml  | 22 ++----
 .../src/main/webapp/WEB-INF/jsp/login.jsp       |  2 +-
 .../src/main/webapp/WEB-INF/web.xml             |  2 +-
 .../shiro/samples/ContainerIntegrationIT.java   | 62 +++++++++++++++
 8 files changed, 117 insertions(+), 68 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/shiro/blob/49c71939/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 05aea3a..af1d102 100644
--- a/pom.xml
+++ b/pom.xml
@@ -90,8 +90,8 @@
              modules' OSGi metadata: -->
         <quartz.version>1.6.1</quartz.version>
         <slf4j.version>1.7.21</slf4j.version>
-        <spring.version>3.1.0.RELEASE</spring.version>
-        <spring-boot.version>1.4.0.RELEASE</spring-boot.version>
+        <spring.version>3.2.17.RELEASE</spring.version>
+        <spring-boot.version>1.4.1.RELEASE</spring-boot.version>
         <guice.version>3.0</guice.version>
 
         <!-- Test 3rd-party dependencies: -->
@@ -99,6 +99,7 @@
         <gmaven.version>1.3</gmaven.version>
         <groovy.version>2.4.7</groovy.version>
         <junit.version>4.12</junit.version>
+        <hibernate.version>4.2.21.Final</hibernate.version>
         <!-- so we can mock static methods in 3rd party libraries that sometimes don't use proper interfaces
              ahem, hazelcast, ahem... -->
         <powermock.version>1.6.5</powermock.version>
@@ -863,8 +864,8 @@
             <dependency>
                 <!-- Used for sample applications only - not required for the framework: -->
                 <groupId>org.hibernate</groupId>
-                <artifactId>hibernate</artifactId>
-                <version>3.2.6.ga</version>
+                <artifactId>hibernate-core</artifactId>
+                <version>${hibernate.version}</version>
                 <optional>true</optional>
                 <exclusions>
                     <exclusion>
@@ -927,7 +928,7 @@
             <dependency>
                 <groupId>org.hibernate</groupId>
                 <artifactId>hibernate-annotations</artifactId>
-                <version>3.2.1.ga</version>
+                <version>3.5.6-Final</version>
                 <optional>true</optional>
             </dependency>
             <dependency>

http://git-wip-us.apache.org/repos/asf/shiro/blob/49c71939/samples/spring-hibernate/pom.xml
----------------------------------------------------------------------
diff --git a/samples/spring-hibernate/pom.xml b/samples/spring-hibernate/pom.xml
index 0f84239..a93edda 100644
--- a/samples/spring-hibernate/pom.xml
+++ b/samples/spring-hibernate/pom.xml
@@ -32,49 +32,6 @@
     <name>Apache Shiro :: Samples :: Spring-Hibernate</name>
     <packaging>war</packaging>
 
-    <build>
-        <plugins>
-            <plugin>
-                <groupId>org.mortbay.jetty</groupId>
-                <artifactId>maven-jetty-plugin</artifactId>
-                <version>${jetty.version}</version>
-                <!-- <configuration>
-                    <contextPath>/shirosprhib</contextPath>
-                    <connectors>
-                        <connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
-                            <port>9080</port>
-                            <maxIdleTime>60000</maxIdleTime>
-                        </connector>
-                    </connectors>
-                    <requestLog implementation="org.mortbay.jetty.NCSARequestLog">
-                        <filename>./target/yyyy_mm_dd.request.log</filename>
-                        <retainDays>90</retainDays>
-                        <append>true</append>
-                        <extended>false</extended>
-                        <logTimeZone>GMT</logTimeZone>
-                    </requestLog>
-                    <systemProperties>
-                        <systemProperty>
-                            <name>org.apache.commons.logging.Log</name>
-                            <value>org.apache.commons.logging.impl.SimpleLog</value>
-                        </systemProperty>
-                        <systemProperty>
-                            <name>java.util.logging.config.file</name>
-                            <value>./target/test-classes/logging.properties</value>
-                        </systemProperty>
-                    </systemProperties>
-                </configuration>
-                <dependencies>
-                    <dependency>
-                        <groupId>hsqldb</groupId>
-                        <artifactId>hsqldb</artifactId>
-                        <version>${hsqldb.version}</version>
-                    </dependency>
-                </dependencies> -->
-            </plugin>
-        </plugins>
-    </build>
-
     <dependencies>
         <dependency>
             <groupId>org.apache.shiro</groupId>
@@ -110,7 +67,7 @@
         </dependency>
         <dependency>
             <groupId>org.hibernate</groupId>
-            <artifactId>hibernate</artifactId>
+            <artifactId>hibernate-core</artifactId>
             <scope>compile</scope>
             <optional>false</optional>
         </dependency>
@@ -135,6 +92,12 @@
             <scope>runtime</scope>
         </dependency>
         <dependency>
+            <groupId>org.hibernate</groupId>
+            <artifactId>hibernate-ehcache</artifactId>
+            <version>${hibernate.version}</version>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
             <groupId>org.springframework</groupId>
             <artifactId>spring-context</artifactId>
         </dependency>
@@ -146,6 +109,36 @@
             <groupId>org.springframework</groupId>
             <artifactId>spring-webmvc</artifactId>
         </dependency>
+
+        <dependency>
+            <groupId>net.sourceforge.htmlunit</groupId>
+            <artifactId>htmlunit</artifactId>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>apache-jsp</artifactId>
+            <version>${jetty.version}</version>
+            <scope>test</scope>
+        </dependency>
+        <dependency>
+            <groupId>javax.servlet</groupId>
+            <artifactId>jstl</artifactId>
+            <scope>runtime</scope>
+        </dependency>
+        <dependency>
+            <groupId>org.eclipse.jetty</groupId>
+            <artifactId>apache-jstl</artifactId>
+            <version>${jetty.version}</version>
+            <type>pom</type>
+            <scope>test</scope>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.shiro.integrationtests</groupId>
+            <artifactId>shiro-its-support</artifactId>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
 
 </project>

http://git-wip-us.apache.org/repos/asf/shiro/blob/49c71939/samples/spring-hibernate/src/main/java/org/apache/shiro/samples/sprhib/dao/HibernateDao.java
----------------------------------------------------------------------
diff --git a/samples/spring-hibernate/src/main/java/org/apache/shiro/samples/sprhib/dao/HibernateDao.java b/samples/spring-hibernate/src/main/java/org/apache/shiro/samples/sprhib/dao/HibernateDao.java
index 3a91f7d..340bd2a 100644
--- a/samples/spring-hibernate/src/main/java/org/apache/shiro/samples/sprhib/dao/HibernateDao.java
+++ b/samples/spring-hibernate/src/main/java/org/apache/shiro/samples/sprhib/dao/HibernateDao.java
@@ -21,7 +21,6 @@ package org.apache.shiro.samples.sprhib.dao;
 import org.hibernate.Session;
 import org.hibernate.SessionFactory;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.orm.hibernate3.SessionFactoryUtils;
 
 /**
  * Convenience superclass for DAOs that contains annotations for injecting the session factory
@@ -37,7 +36,7 @@ public abstract class HibernateDao {
     }
 
     public Session getSession() {
-        return SessionFactoryUtils.getSession(this.sessionFactory, true);
+        return sessionFactory.getCurrentSession();
     }    
 
 }

http://git-wip-us.apache.org/repos/asf/shiro/blob/49c71939/samples/spring-hibernate/src/main/java/org/apache/shiro/samples/sprhib/model/Role.java
----------------------------------------------------------------------
diff --git a/samples/spring-hibernate/src/main/java/org/apache/shiro/samples/sprhib/model/Role.java b/samples/spring-hibernate/src/main/java/org/apache/shiro/samples/sprhib/model/Role.java
index 9115239..4c40d31 100644
--- a/samples/spring-hibernate/src/main/java/org/apache/shiro/samples/sprhib/model/Role.java
+++ b/samples/spring-hibernate/src/main/java/org/apache/shiro/samples/sprhib/model/Role.java
@@ -81,7 +81,7 @@ public class Role {
         this.description = description;
     }
 
-    @CollectionOfElements
+    @ElementCollection(targetClass=String.class)
     @JoinTable(name="roles_permissions")
     @Cache(usage=CacheConcurrencyStrategy.READ_WRITE)
     public Set<String> getPermissions() {

http://git-wip-us.apache.org/repos/asf/shiro/blob/49c71939/samples/spring-hibernate/src/main/webapp/WEB-INF/applicationContext.xml
----------------------------------------------------------------------
diff --git a/samples/spring-hibernate/src/main/webapp/WEB-INF/applicationContext.xml b/samples/spring-hibernate/src/main/webapp/WEB-INF/applicationContext.xml
index f852ec3..abcdb5e 100644
--- a/samples/spring-hibernate/src/main/webapp/WEB-INF/applicationContext.xml
+++ b/samples/spring-hibernate/src/main/webapp/WEB-INF/applicationContext.xml
@@ -51,32 +51,26 @@
     </bean>
 
     <!-- Hibernate SessionFactory -->
-    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
+    <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
         <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"/>
         <!-- Scan packages for JPA annotations -->
         <property name="packagesToScan" value="org.apache.shiro.samples.sprhib.model"/>
         <property name="hibernateProperties">
             <props>
                 <prop key="hibernate.dialect">org.hibernate.dialect.HSQLDialect</prop>
                 <prop key="hibernate.jdbc.fetch_size">100</prop>
-                <prop key="hibernate.cache.provider_class">net.sf.ehcache.hibernate.SingletonEhCacheProvider</prop>
+
+                <!-- 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. -->
+                <prop key="hibernate.hbm2ddl.auto">update</prop>
+                <prop key="hibernate.cache.region.factory_class">org.hibernate.cache.ehcache.EhCacheRegionFactory</prop>
             </props>
         </property>
-        <property name="eventListeners">
-            <map>
-                <entry key="merge">
-                    <bean class="org.springframework.orm.hibernate3.support.IdTransferringMergeEventListener"/>
-                </entry>
-            </map>
-        </property>
     </bean>
 
     <!-- Transaction support beans -->
-    <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
+    <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
         <property name="sessionFactory" ref="sessionFactory"/>
     </bean>
 

http://git-wip-us.apache.org/repos/asf/shiro/blob/49c71939/samples/spring-hibernate/src/main/webapp/WEB-INF/jsp/login.jsp
----------------------------------------------------------------------
diff --git a/samples/spring-hibernate/src/main/webapp/WEB-INF/jsp/login.jsp b/samples/spring-hibernate/src/main/webapp/WEB-INF/jsp/login.jsp
index 7c16c17..54e284e 100644
--- a/samples/spring-hibernate/src/main/webapp/WEB-INF/jsp/login.jsp
+++ b/samples/spring-hibernate/src/main/webapp/WEB-INF/jsp/login.jsp
@@ -29,7 +29,7 @@
         <div class="title">Apache Shiro Sample App - Login</div>
 
         <div class="content">
-            <form:form modelAttribute="loginCommand">
+            <form:form modelAttribute="loginCommand" name="loginForm">
 
                 <form:errors path="*" element="div" cssClass="errors"/>
 

http://git-wip-us.apache.org/repos/asf/shiro/blob/49c71939/samples/spring-hibernate/src/main/webapp/WEB-INF/web.xml
----------------------------------------------------------------------
diff --git a/samples/spring-hibernate/src/main/webapp/WEB-INF/web.xml b/samples/spring-hibernate/src/main/webapp/WEB-INF/web.xml
index 12992bf..50926ee 100644
--- a/samples/spring-hibernate/src/main/webapp/WEB-INF/web.xml
+++ b/samples/spring-hibernate/src/main/webapp/WEB-INF/web.xml
@@ -55,7 +55,7 @@
  -  =================================================================== -->
     <filter>
         <filter-name>openSessionInViewFilter</filter-name>
-        <filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
+        <filter-class>org.springframework.orm.hibernate4.support.OpenSessionInViewFilter</filter-class>
     </filter>
 
     <!-- Shiro Filter is defined in the spring application context: -->

http://git-wip-us.apache.org/repos/asf/shiro/blob/49c71939/samples/spring-hibernate/src/test/java/org/apache/shiro/samples/ContainerIntegrationIT.java
----------------------------------------------------------------------
diff --git a/samples/spring-hibernate/src/test/java/org/apache/shiro/samples/ContainerIntegrationIT.java b/samples/spring-hibernate/src/test/java/org/apache/shiro/samples/ContainerIntegrationIT.java
new file mode 100644
index 0000000..12c2247
--- /dev/null
+++ b/samples/spring-hibernate/src/test/java/org/apache/shiro/samples/ContainerIntegrationIT.java
@@ -0,0 +1,62 @@
+/*
+ * 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.apache.shiro.samples;
+
+import com.gargoylesoftware.htmlunit.ElementNotFoundException;
+import com.gargoylesoftware.htmlunit.FailingHttpStatusCodeException;
+import com.gargoylesoftware.htmlunit.WebClient;
+import com.gargoylesoftware.htmlunit.html.HtmlForm;
+import com.gargoylesoftware.htmlunit.html.HtmlInput;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import org.apache.shiro.testing.web.AbstractContainerIT;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+
+
+public class ContainerIntegrationIT extends AbstractContainerIT {
+
+    protected final WebClient webClient = new WebClient();
+
+    @Before
+    public void logOut() throws IOException {
+        // Make sure we are logged out
+        final HtmlPage homePage = webClient.getPage(getBaseUri());
+        try {
+            homePage.getAnchorByHref("/s/logout").click();
+        }
+        catch (ElementNotFoundException e) {
+            //Ignore
+        }
+    }
+
+    @Test
+    public void logIn() throws FailingHttpStatusCodeException, IOException, InterruptedException {
+
+        HtmlPage page = webClient.getPage(getBaseUri() + "s/login");
+        HtmlForm form = page.getFormByName("loginForm");
+        form.<HtmlInput>getInputByName("username").setValueAttribute("admin");
+        form.<HtmlInput>getInputByName("password").setValueAttribute("admin");
+        page = form.<HtmlInput>getInputByValue("Login").click();
+        // This'll throw an expection if not logged in
+        page.getAnchorByHref("/s/logout");
+    }
+}