You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shiro.apache.org by lh...@apache.org on 2009/09/02 23:45:33 UTC
svn commit: r810706 - in /incubator/shiro/trunk: ./ all/ core/
core/src/main/java/org/apache/shiro/authc/
core/src/main/java/org/apache/shiro/mgt/
core/src/main/java/org/apache/shiro/subject/ samples/quickstart/
samples/spring-hibernate/ samples/spring...
Author: lhazlewood
Date: Wed Sep 2 21:45:32 2009
New Revision: 810706
URL: http://svn.apache.org/viewvc?rev=810706&view=rev
Log:
SHIRO-92: added interface method and implementation
SHIRO-93: applied patches and added Apache license header
general apache header verification for all pom.xml files
Added:
incubator/shiro/trunk/samples/web/src/test/
incubator/shiro/trunk/samples/web/src/test/java/
incubator/shiro/trunk/samples/web/src/test/java/org/
incubator/shiro/trunk/samples/web/src/test/java/org/apache/
incubator/shiro/trunk/samples/web/src/test/java/org/apache/shiro/
incubator/shiro/trunk/samples/web/src/test/java/org/apache/shiro/test/
incubator/shiro/trunk/samples/web/src/test/java/org/apache/shiro/test/AbstractContainerTest.java
incubator/shiro/trunk/samples/web/src/test/java/org/apache/shiro/test/ContainerIntegrationTest.java
Modified:
incubator/shiro/trunk/all/pom.xml
incubator/shiro/trunk/core/pom.xml
incubator/shiro/trunk/core/src/main/java/org/apache/shiro/authc/RememberMeAuthenticationToken.java
incubator/shiro/trunk/core/src/main/java/org/apache/shiro/mgt/DefaultSecurityManager.java
incubator/shiro/trunk/core/src/main/java/org/apache/shiro/subject/DelegatingSubject.java
incubator/shiro/trunk/core/src/main/java/org/apache/shiro/subject/Subject.java
incubator/shiro/trunk/pom.xml
incubator/shiro/trunk/samples/quickstart/pom.xml
incubator/shiro/trunk/samples/spring-hibernate/pom.xml
incubator/shiro/trunk/samples/spring/pom.xml
incubator/shiro/trunk/samples/web/pom.xml
incubator/shiro/trunk/samples/web/src/main/resources/log4j.properties
incubator/shiro/trunk/samples/web/src/main/webapp/home.jsp
incubator/shiro/trunk/support/ehcache/pom.xml
incubator/shiro/trunk/support/pom.xml
incubator/shiro/trunk/support/quartz/pom.xml
incubator/shiro/trunk/support/spring/pom.xml
incubator/shiro/trunk/web/pom.xml
Modified: incubator/shiro/trunk/all/pom.xml
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/all/pom.xml?rev=810706&r1=810705&r2=810706&view=diff
==============================================================================
--- incubator/shiro/trunk/all/pom.xml (original)
+++ incubator/shiro/trunk/all/pom.xml Wed Sep 2 21:45:32 2009
@@ -1,20 +1,23 @@
<?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.
--->
+ ~ 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.
+ -->
+<!--suppress osmorcNonOsgiMavenDependency -->
<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/maven-v4_0_0.xsd">
Modified: incubator/shiro/trunk/core/pom.xml
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/core/pom.xml?rev=810706&r1=810705&r2=810706&view=diff
==============================================================================
--- incubator/shiro/trunk/core/pom.xml (original)
+++ incubator/shiro/trunk/core/pom.xml Wed Sep 2 21:45:32 2009
@@ -17,6 +17,7 @@
~ specific language governing permissions and limitations
~ under the License.
-->
+<!--suppress osmorcNonOsgiMavenDependency -->
<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/maven-v4_0_0.xsd">
Modified: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/authc/RememberMeAuthenticationToken.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/core/src/main/java/org/apache/shiro/authc/RememberMeAuthenticationToken.java?rev=810706&r1=810705&r2=810706&view=diff
==============================================================================
--- incubator/shiro/trunk/core/src/main/java/org/apache/shiro/authc/RememberMeAuthenticationToken.java (original)
+++ incubator/shiro/trunk/core/src/main/java/org/apache/shiro/authc/RememberMeAuthenticationToken.java Wed Sep 2 21:45:32 2009
@@ -19,47 +19,25 @@
package org.apache.shiro.authc;
/**
- * An <tt>AuthenticationToken</tt> that indicates if the user wishes their identity to be remembered across sessions.
- *
- * <p>Please note however that when a new session is created for the corresponding user, that user's identity would be
- * remembered, but they are <em>NOT</em> considered authenticated:
- *
- * <p>Authentication is the process of proving you are who you say you are. In a RememberMe scenario, a remembered
- * identity gives the system an idea who that person probably is, but in reality, has no way of guaranteeing the
- * remembered identity <em>really</em> is that user.
- *
- * <p>So, although many parts of the application can still perform user-specific logic based on the remembered
- * identity, such as customized views, it should never perform security-sensitive operations until the user has
- * actually executed a successful authentication attempt.
- *
- * <p>We see this paradigm all over the web, and we'll use <tt>amazon.com</tt> as an example:
- *
- * <p>When you visit Amazon.com and perform a login and ask it to 'remember me', it will set a cookie with your
- * identity. If you don't log out and your session expires, and you come back, say the next day, Amazon still knows
- * who you <em>probably</em> are: you still see all of your book and movie recommendations and similar user-specific
- * features since these are based on your (remembered) user id.</p>
- *
- * <p>BUT, if you try to do some sensitive operations, such as access your account's billing data, Amazon forces you
- * to do an actual log-in, requiring your username and password.
- *
- * <p>This is because although amazon.com assumed your identity from 'remember me', it recognized that you were not
- * actually authenticated. The only way to really guarantee you are who you say you are, and therefore able to
- * access sensitive account data, is for you to perform an actual authentication.
+ * An {@code AuthenticationToken} that indicates if the user wishes their identity to be remembered across sessions.
+ * <p/>
+ * Note however that when a new session is created for the corresponding user, that user's identity would be
+ * remembered, but they are <em>NOT</em> considered authenticated. Please see the
+ * {@link org.apache.shiro.subject.Subject#isRemembered()} JavaDoc for an in-depth explanation of the semantic
+ * differences of what it means to be remembered vs. authenticated.
*
* @author Les Hazlewood
+ * @see org.apache.shiro.subject.Subject#isRemembered()
* @since 0.9
*/
public interface RememberMeAuthenticationToken extends AuthenticationToken {
/**
- * Returns <tt>true</tt> if the submitting user wishes their identity (principal(s)) to be remembered
- * across sessions, <tt>false</tt> otherwise.
- *
- * <p>Please see the class-level JavaDoc for what 'remember me' vs. 'authenticated' means - they are semantically
- * different.
+ * Returns {@code true} if the submitting user wishes their identity (principal(s)) to be remembered
+ * across sessions, {@code false} otherwise.
*
- * @return <tt>true</tt> if the submitting user wishes their identity (principal(s)) to be remembered
- * across sessions, <tt>false</tt> otherwise.
+ * @return {@code true} if the submitting user wishes their identity (principal(s)) to be remembered
+ * across sessions, {@code false} otherwise.
*/
boolean isRememberMe();
Modified: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/mgt/DefaultSecurityManager.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/core/src/main/java/org/apache/shiro/mgt/DefaultSecurityManager.java?rev=810706&r1=810705&r2=810706&view=diff
==============================================================================
--- incubator/shiro/trunk/core/src/main/java/org/apache/shiro/mgt/DefaultSecurityManager.java (original)
+++ incubator/shiro/trunk/core/src/main/java/org/apache/shiro/mgt/DefaultSecurityManager.java Wed Sep 2 21:45:32 2009
@@ -451,10 +451,11 @@
"for subject construction by the SubjectFactory.");
ctx = new HashMap(context);
ctx.put(SubjectFactory.PRINCIPALS, principals);
+ } else {
+ log.trace("No remembered identity found. Returning original context.");
}
}
- log.trace("No remembered identity found. Returning original context.");
return ctx;
}
Modified: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/subject/DelegatingSubject.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/core/src/main/java/org/apache/shiro/subject/DelegatingSubject.java?rev=810706&r1=810705&r2=810706&view=diff
==============================================================================
--- incubator/shiro/trunk/core/src/main/java/org/apache/shiro/subject/DelegatingSubject.java (original)
+++ incubator/shiro/trunk/core/src/main/java/org/apache/shiro/subject/DelegatingSubject.java Wed Sep 2 21:45:32 2009
@@ -272,6 +272,11 @@
return authenticated;
}
+ public boolean isRemembered() {
+ PrincipalCollection principals = getPrincipals();
+ return principals != null && !principals.isEmpty() && !isAuthenticated();
+ }
+
public Session getSession() {
return getSession(true);
}
Modified: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/subject/Subject.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/core/src/main/java/org/apache/shiro/subject/Subject.java?rev=810706&r1=810705&r2=810706&view=diff
==============================================================================
--- incubator/shiro/trunk/core/src/main/java/org/apache/shiro/subject/Subject.java (original)
+++ incubator/shiro/trunk/core/src/main/java/org/apache/shiro/subject/Subject.java Wed Sep 2 21:45:32 2009
@@ -102,8 +102,8 @@
* <p/>
* For convenience's sake, it is convention that the first principal in this collection be the application's
* "primary" principal. That is, {@code getPrincipals().iterator().next();} would return this
- * primary uniquely-identifying principal.
- * In fact, this logic is often the implementation of the {@link #getPrincipal() getPrincipal()} method.
+ * primary uniquely-identifying principal. Most {@link #getPrincipal() getPrincipal()} implementations will use
+ * this logic.
*
* @return all of this Subject's principals (identifying attributes).
* @see #getPrincipal()
@@ -329,9 +329,7 @@
* <p/>
* Note that even if this Subject's identity has been remembered via 'remember me' services, this method will
* still return {@code false} unless the user has actually logged in with proper credentials <em>during their
- * current session</em>. See the
- * {@link org.apache.shiro.authc.RememberMeAuthenticationToken RememberMeAuthenticationToken} class JavaDoc for why
- * this would occur.
+ * current session</em>. See the {@link #isRemembered() isRemembered()} method JavaDoc for more.
*
* @return {@code true} if this Subject proved their identity during their current session
* by providing valid credentials matching those known to the system, {@code false} otherwise.
@@ -339,6 +337,55 @@
*/
boolean isAuthenticated();
+
+ /**
+ * Returns {@code true} if this {@code Subject} has an identity (it is not anonymous) and the identity
+ * (aka {@link #getPrincipals() principals}) is remembered from a successful authentication during a previous
+ * session.
+ * <p/>
+ * Although the underlying implementation determines exactly how this method functions, most implementations have
+ * this method act as the logical equivalent to this code:
+ * <pre>
+ * {@link #getPrincipal() getPrincipal()} != null && !{@link #isAuthenticated() isAuthenticated()}</pre>
+ * <p/>
+ * Note as indicated by the above code example, if a {@code Subject} is remembered, they are
+ * <em>NOT</em> considered authenticated. A check against {@link #isAuthenticated() isAuthenticated()} is a more
+ * strict check than that reflected by this method. For example, a check to see if a subject can access financial
+ * information should probably depend on {@link #isAuthenticated() isAuthenticated()} to <em>guarantee</em> a
+ * proven identity, and not this method.
+ * <p/>
+ * Once the subject is authenticated, they are no longer considered remembered because identity would have been
+ * proven during the current session.
+ * <h4>Remembered vs Authenticated</h4>
+ * Authentication is the process of <em>proving</em> you are who you say you are. When a user is only remembered,
+ * the remenbered identity gives the system an idea who that user probably is, but in reality, has no way of
+ * absolutely <em>guaranteeing</em> if the remembered {@code Subject} represents the user currently
+ * using the application.
+ * <p/>
+ * So although many parts of the application can still perform user-specific logic based on the remembered
+ * {@link #getPrincipals() principals}, such as customized views, it should never perform highly-sensitive
+ * operations until the user has legitimately proven their identity by executing a successful authentication attempt.
+ * <p/>
+ * We see this paradigm all over the web, and we'll use <a href="http://www.amazon.com">Amazon.com</a> as an example:
+ * <p/>
+ * When you visit Amazon.com and perform a login and ask it to 'remember me', it will set a cookie with your
+ * identity. If you don't log out and your session expires, and you come back, say the next day, Amazon still knows
+ * who you <em>probably</em> are: you still see all of your book and movie recommendations and similar user-specific
+ * features since these are based on your (remembered) user id.
+ * <p/>
+ * BUT, if you try to do something sensitive, such as access your account's billing data, Amazon forces you
+ * to do an actual log-in, requiring your username and password.
+ * <p/>
+ * This is because although amazon.com assumed your identity from 'remember me', it recognized that you were not
+ * actually authenticated. The only way to really guarantee you are who you say you are, and therefore allow you
+ * access to sensitive account data, is to force you to perform an actual successful authentication.
+ *
+ * @return {@code true} if this {@code Subject}'s identity (aka {@link #getPrincipals() principals}) is
+ * remembered from a successful authentication during a previous session, {@code false} otherwise.
+ * @since 1.0
+ */
+ boolean isRemembered();
+
/**
* Returns the application {@code Session} associated with this Subject. If no session exists when this
* method is called, a new session will be created, associated with this Subject, and then returned.
@@ -447,10 +494,21 @@
*/
public static class Builder {
+ /**
+ * Will hold all contextual data via the Builder instance's method invocations to be sent to the
+ * {@code SecurityManager} during the {@link #buildSubject} call.
+ */
private final Map<String, Object> subjectContext;
+ /**
+ * The SecurityManager to invoke during the {@link #buildSubject} call.
+ */
private final org.apache.shiro.mgt.SecurityManager securityManager;
+ /**
+ * Constructs a new {@link Subject.Builder} instance, using the
+ * {@link org.apache.shiro.SecurityUtils#getSecurityManager()}
+ */
public Builder() {
this(SecurityUtils.getSecurityManager());
}
Modified: incubator/shiro/trunk/pom.xml
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/pom.xml?rev=810706&r1=810705&r2=810706&view=diff
==============================================================================
--- incubator/shiro/trunk/pom.xml (original)
+++ incubator/shiro/trunk/pom.xml Wed Sep 2 21:45:32 2009
@@ -17,6 +17,7 @@
~ specific language governing permissions and limitations
~ under the License.
-->
+<!--suppress osmorcNonOsgiMavenDependency -->
<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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
@@ -59,7 +60,7 @@
<jdk.version>1.5</jdk.version>
<slf4j.version>1.5.6</slf4j.version>
<hsqldbVersion>1.8.0.7</hsqldbVersion>
- <jettyVersion>6.1.14</jettyVersion>
+ <jettyVersion>6.1.20</jettyVersion>
<springframeworkVersion>2.5.6</springframeworkVersion>
</properties>
@@ -270,7 +271,6 @@
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
- <scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
Modified: incubator/shiro/trunk/samples/quickstart/pom.xml
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/samples/quickstart/pom.xml?rev=810706&r1=810705&r2=810706&view=diff
==============================================================================
--- incubator/shiro/trunk/samples/quickstart/pom.xml (original)
+++ incubator/shiro/trunk/samples/quickstart/pom.xml Wed Sep 2 21:45:32 2009
@@ -17,6 +17,7 @@
~ specific language governing permissions and limitations
~ under the License.
-->
+<!--suppress osmorcNonOsgiMavenDependency -->
<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/maven-v4_0_0.xsd">
Modified: incubator/shiro/trunk/samples/spring-hibernate/pom.xml
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/samples/spring-hibernate/pom.xml?rev=810706&r1=810705&r2=810706&view=diff
==============================================================================
--- incubator/shiro/trunk/samples/spring-hibernate/pom.xml (original)
+++ incubator/shiro/trunk/samples/spring-hibernate/pom.xml Wed Sep 2 21:45:32 2009
@@ -17,6 +17,7 @@
~ specific language governing permissions and limitations
~ under the License.
-->
+<!--suppress osmorcNonOsgiMavenDependency -->
<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/maven-v4_0_0.xsd">
Modified: incubator/shiro/trunk/samples/spring/pom.xml
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/samples/spring/pom.xml?rev=810706&r1=810705&r2=810706&view=diff
==============================================================================
--- incubator/shiro/trunk/samples/spring/pom.xml (original)
+++ incubator/shiro/trunk/samples/spring/pom.xml Wed Sep 2 21:45:32 2009
@@ -17,6 +17,7 @@
~ specific language governing permissions and limitations
~ under the License.
-->
+<!--suppress osmorcNonOsgiMavenDependency -->
<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/maven-v4_0_0.xsd">
Modified: incubator/shiro/trunk/samples/web/pom.xml
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/samples/web/pom.xml?rev=810706&r1=810705&r2=810706&view=diff
==============================================================================
--- incubator/shiro/trunk/samples/web/pom.xml (original)
+++ incubator/shiro/trunk/samples/web/pom.xml Wed Sep 2 21:45:32 2009
@@ -1,3 +1,23 @@
+<?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.
+ -->
+<!--suppress osmorcNonOsgiMavenDependency -->
<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/maven-v4_0_0.xsd">
@@ -15,11 +35,17 @@
<build>
<plugins>
<plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <forkMode>never</forkMode>
+ </configuration>
+ </plugin>
+ <plugin>
<groupId>org.mortbay.jetty</groupId>
<artifactId>maven-jetty-plugin</artifactId>
<version>${jettyVersion}</version>
<configuration>
- <contextPath>/shiro</contextPath>
+ <contextPath>/</contextPath>
<connectors>
<connector implementation="org.mortbay.jetty.nio.SelectChannelConnector">
<port>9080</port>
@@ -59,6 +85,12 @@
<scope>runtime</scope>
</dependency>
<dependency>
+ <groupId>net.sourceforge.htmlunit</groupId>
+ <artifactId>htmlunit</artifactId>
+ <version>2.5</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>org.apache.shiro</groupId>
<artifactId>shiro-core</artifactId>
</dependency>
@@ -67,6 +99,18 @@
<artifactId>shiro-web</artifactId>
</dependency>
<dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jetty</artifactId>
+ <version>${jettyVersion}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.mortbay.jetty</groupId>
+ <artifactId>jsp-2.1-jetty</artifactId>
+ <version>${jettyVersion}</version>
+ <scope>test</scope>
+ </dependency>
+ <dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
</dependency>
Modified: incubator/shiro/trunk/samples/web/src/main/resources/log4j.properties
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/samples/web/src/main/resources/log4j.properties?rev=810706&r1=810705&r2=810706&view=diff
==============================================================================
--- incubator/shiro/trunk/samples/web/src/main/resources/log4j.properties (original)
+++ incubator/shiro/trunk/samples/web/src/main/resources/log4j.properties Wed Sep 2 21:45:32 2009
@@ -40,8 +40,9 @@
# Apache Shiro
# =============================================================================
# Shiro security framework
-log4j.logger.org.apache.shiro.realm.text.PropertiesRealm=INFO
-log4j.logger.org.apache.shiro.cache.ehcache.EhCache=INFO
-log4j.logger.org.apache.shiro.io=INFO
-log4j.logger.org.apache.shiro.web.servlet=INFO
+log4j.logger.org.apache.shiro=TRACE
+#log4j.logger.org.apache.shiro.realm.text.PropertiesRealm=INFO
+#log4j.logger.org.apache.shiro.cache.ehcache.EhCache=INFO
+#log4j.logger.org.apache.shiro.io=INFO
+#log4j.logger.org.apache.shiro.web.servlet=INFO
log4j.logger.org.apache.shiro.util.ThreadContext=INFO
Modified: incubator/shiro/trunk/samples/web/src/main/webapp/home.jsp
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/samples/web/src/main/webapp/home.jsp?rev=810706&r1=810705&r2=810706&view=diff
==============================================================================
--- incubator/shiro/trunk/samples/web/src/main/webapp/home.jsp (original)
+++ incubator/shiro/trunk/samples/web/src/main/webapp/home.jsp Wed Sep 2 21:45:32 2009
@@ -21,6 +21,7 @@
<html>
<head>
<link type="text/css" rel="stylesheet" href="<c:url value="/style.css"/>"/>
+ <title>Apache Shiro Quickstart</title>
</head>
<body>
Added: incubator/shiro/trunk/samples/web/src/test/java/org/apache/shiro/test/AbstractContainerTest.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/samples/web/src/test/java/org/apache/shiro/test/AbstractContainerTest.java?rev=810706&view=auto
==============================================================================
--- incubator/shiro/trunk/samples/web/src/test/java/org/apache/shiro/test/AbstractContainerTest.java (added)
+++ incubator/shiro/trunk/samples/web/src/test/java/org/apache/shiro/test/AbstractContainerTest.java Wed Sep 2 21:45:32 2009
@@ -0,0 +1,90 @@
+/*
+ * 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 org.junit.AfterClass;
+import static org.junit.Assert.assertTrue;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.mortbay.jetty.Connector;
+import org.mortbay.jetty.Handler;
+import org.mortbay.jetty.Server;
+import org.mortbay.jetty.handler.DefaultHandler;
+import org.mortbay.jetty.handler.HandlerCollection;
+import org.mortbay.jetty.nio.SelectChannelConnector;
+import org.mortbay.jetty.webapp.WebAppContext;
+
+public abstract class AbstractContainerTest {
+ protected static PauseableServer server;
+
+ protected static final int port = 8180;
+
+ protected static final String BASEURI = "http://localhost:" + port + "/";
+
+ protected final WebClient webClient = new WebClient();
+
+ @BeforeClass
+ public static void startContainer() throws Exception {
+ if (server == null) {
+ server = new PauseableServer();
+ Connector connector = new SelectChannelConnector();
+ connector.setPort(port);
+ server.setConnectors(new Connector[]{connector});
+
+ WebAppContext context = new WebAppContext("src/main/webapp", "/");
+
+ HandlerCollection handlers = new HandlerCollection();
+ handlers.setHandlers(new Handler[]{context, new DefaultHandler()});
+ server.setHandler(handlers);
+ server.start();
+ assertTrue(server.isStarted());
+
+ }
+ }
+
+ @AfterClass
+ public static void stopContainer() throws Exception {
+ // Don't stop the server here, because it causes issues with already initialized
+ // statics - for example with file upload
+ // server.stop();
+ // server = null;
+ }
+
+ @Before
+ public void beforeTest() {
+ webClient.setThrowExceptionOnFailingStatusCode(true);
+ }
+
+ public void pauseServer(boolean paused) {
+ if (server != null) server.pause(paused);
+ }
+
+ public static class PauseableServer extends Server {
+ public synchronized void pause(boolean paused) {
+ try {
+ if (paused) for (Connector connector : getConnectors())
+ connector.stop();
+ else for (Connector connector : getConnectors())
+ connector.start();
+ } catch (Exception e) {
+ }
+ }
+ }
+}
Added: incubator/shiro/trunk/samples/web/src/test/java/org/apache/shiro/test/ContainerIntegrationTest.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/samples/web/src/test/java/org/apache/shiro/test/ContainerIntegrationTest.java?rev=810706&view=auto
==============================================================================
--- incubator/shiro/trunk/samples/web/src/test/java/org/apache/shiro/test/ContainerIntegrationTest.java (added)
+++ incubator/shiro/trunk/samples/web/src/test/java/org/apache/shiro/test/ContainerIntegrationTest.java Wed Sep 2 21:45:32 2009
@@ -0,0 +1,37 @@
+/*
+ * 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.FailingHttpStatusCodeException;
+import static com.gargoylesoftware.htmlunit.WebAssert.assertTitleEquals;
+import com.gargoylesoftware.htmlunit.html.HtmlPage;
+import org.junit.Test;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+
+public class ContainerIntegrationTest extends AbstractContainerTest {
+ @Test
+ public void checkOrganizationsDisplayedOnIndexPage() throws FailingHttpStatusCodeException, MalformedURLException, IOException {
+ final HtmlPage page = webClient.getPage(BASEURI);
+ //assertTrue(page.getTitleText().contains("Apache Shiro Quickstart") );
+ assertTitleEquals(page, "Apache Shiro Quickstart");
+
+ }
+}
Modified: incubator/shiro/trunk/support/ehcache/pom.xml
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/support/ehcache/pom.xml?rev=810706&r1=810705&r2=810706&view=diff
==============================================================================
--- incubator/shiro/trunk/support/ehcache/pom.xml (original)
+++ incubator/shiro/trunk/support/ehcache/pom.xml Wed Sep 2 21:45:32 2009
@@ -17,6 +17,7 @@
~ specific language governing permissions and limitations
~ under the License.
-->
+<!--suppress osmorcNonOsgiMavenDependency -->
<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/maven-v4_0_0.xsd">
Modified: incubator/shiro/trunk/support/pom.xml
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/support/pom.xml?rev=810706&r1=810705&r2=810706&view=diff
==============================================================================
--- incubator/shiro/trunk/support/pom.xml (original)
+++ incubator/shiro/trunk/support/pom.xml Wed Sep 2 21:45:32 2009
@@ -1,3 +1,22 @@
+<?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/maven-v4_0_0.xsd">
Modified: incubator/shiro/trunk/support/quartz/pom.xml
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/support/quartz/pom.xml?rev=810706&r1=810705&r2=810706&view=diff
==============================================================================
--- incubator/shiro/trunk/support/quartz/pom.xml (original)
+++ incubator/shiro/trunk/support/quartz/pom.xml Wed Sep 2 21:45:32 2009
@@ -17,6 +17,7 @@
~ specific language governing permissions and limitations
~ under the License.
-->
+<!--suppress osmorcNonOsgiMavenDependency -->
<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/maven-v4_0_0.xsd">
Modified: incubator/shiro/trunk/support/spring/pom.xml
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/support/spring/pom.xml?rev=810706&r1=810705&r2=810706&view=diff
==============================================================================
--- incubator/shiro/trunk/support/spring/pom.xml (original)
+++ incubator/shiro/trunk/support/spring/pom.xml Wed Sep 2 21:45:32 2009
@@ -17,6 +17,7 @@
~ specific language governing permissions and limitations
~ under the License.
-->
+<!--suppress osmorcNonOsgiMavenDependency -->
<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/maven-v4_0_0.xsd">
Modified: incubator/shiro/trunk/web/pom.xml
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/web/pom.xml?rev=810706&r1=810705&r2=810706&view=diff
==============================================================================
--- incubator/shiro/trunk/web/pom.xml (original)
+++ incubator/shiro/trunk/web/pom.xml Wed Sep 2 21:45:32 2009
@@ -17,6 +17,7 @@
~ specific language governing permissions and limitations
~ under the License.
-->
+<!--suppress osmorcNonOsgiMavenDependency -->
<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/maven-v4_0_0.xsd">