You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@shiro.apache.org by ad...@apache.org on 2009/06/18 05:13:47 UTC

svn commit: r785881 [11/11] - in /incubator/shiro/trunk: ./ all/ core/src/main/java/org/apache/ki/ core/src/main/java/org/apache/shiro/ core/src/main/java/org/apache/shiro/aop/ core/src/main/java/org/apache/shiro/authc/ core/src/main/java/org/apache/sh...

Modified: incubator/shiro/trunk/web/src/main/java/org/apache/shiro/web/tags/SecureTag.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/web/src/main/java/org/apache/shiro/web/tags/SecureTag.java?rev=785881&r1=785781&r2=785881&view=diff
==============================================================================
--- incubator/shiro/trunk/web/src/main/java/org/apache/shiro/web/tags/SecureTag.java (original)
+++ incubator/shiro/trunk/web/src/main/java/org/apache/shiro/web/tags/SecureTag.java Thu Jun 18 03:13:34 2009
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.ki.web.tags;
+package org.apache.shiro.web.tags;
 
 import javax.servlet.jsp.JspException;
 import javax.servlet.jsp.tagext.TagSupport;
@@ -24,8 +24,8 @@
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 
-import org.apache.ki.SecurityUtils;
-import org.apache.ki.subject.Subject;
+import org.apache.shiro.SecurityUtils;
+import org.apache.shiro.subject.Subject;
 
 /**
  * @author Les Hazlewood

Modified: incubator/shiro/trunk/web/src/main/java/org/apache/shiro/web/tags/UserTag.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/web/src/main/java/org/apache/shiro/web/tags/UserTag.java?rev=785881&r1=785781&r2=785881&view=diff
==============================================================================
--- incubator/shiro/trunk/web/src/main/java/org/apache/shiro/web/tags/UserTag.java (original)
+++ incubator/shiro/trunk/web/src/main/java/org/apache/shiro/web/tags/UserTag.java Thu Jun 18 03:13:34 2009
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.ki.web.tags;
+package org.apache.shiro.web.tags;
 
 import javax.servlet.jsp.JspException;
 
@@ -34,7 +34,7 @@
  * guarantees that the current user has logged in <em>during their current session</em>, proving they really are
  * who they say they are.
  *
- * <p>The logically opposite tag of this one is the {@link org.apache.ki.web.tags.GuestTag}.
+ * <p>The logically opposite tag of this one is the {@link org.apache.shiro.web.tags.GuestTag}.
  *
  * @author Les Hazlewood
  * @since 0.9

Modified: incubator/shiro/trunk/web/src/main/java/org/apache/shiro/web/tags/package-info.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/web/src/main/java/org/apache/shiro/web/tags/package-info.java?rev=785881&r1=785781&r2=785881&view=diff
==============================================================================
--- incubator/shiro/trunk/web/src/main/java/org/apache/shiro/web/tags/package-info.java (original)
+++ incubator/shiro/trunk/web/src/main/java/org/apache/shiro/web/tags/package-info.java Thu Jun 18 03:13:34 2009
@@ -17,9 +17,9 @@
  * under the License.
  */
 /**
- * Provides the Ki JSP Tag Library implementations.
+ * Provides the Shiro JSP Tag Library implementations.
  * <p/>
- * Ki JSP Tags can be used to evalute or not evaluate (show or not show) parts of a JSP page based on the
+ * Shiro JSP Tags can be used to evalute or not evaluate (show or not show) parts of a JSP page based on the
  * current user's authentication status and/or authorization (access control) abilities.
  */
-package org.apache.ki.web.tags;
+package org.apache.shiro.web.tags;

Copied: incubator/shiro/trunk/web/src/main/resources/META-INF/shiro.tld (from r785781, incubator/shiro/trunk/web/src/main/resources/META-INF/ki.tld)
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/web/src/main/resources/META-INF/shiro.tld?p2=incubator/shiro/trunk/web/src/main/resources/META-INF/shiro.tld&p1=incubator/shiro/trunk/web/src/main/resources/META-INF/ki.tld&r1=785781&r2=785881&rev=785881&view=diff
==============================================================================
--- incubator/shiro/trunk/web/src/main/resources/META-INF/ki.tld (original)
+++ incubator/shiro/trunk/web/src/main/resources/META-INF/shiro.tld Thu Jun 18 03:13:34 2009
@@ -26,15 +26,15 @@
 
   <jsp-version>1.2</jsp-version>
 
-  <short-name>Apache Ki</short-name>
+  <short-name>Apache Shiro</short-name>
 
-  <uri>http://ki.apache.org/tags</uri>
+  <uri>http://shiro.apache.org/tags</uri>
 
-  <description>Apache Ki JSP Tag Library.</description>
+  <description>Apache Shiro JSP Tag Library.</description>
 
   <tag>
     <name>hasPermission</name>
-    <tag-class>org.apache.ki.web.tags.HasPermissionTag</tag-class>
+    <tag-class>org.apache.shiro.web.tags.HasPermissionTag</tag-class>
     <body-content>JSP</body-content>
     <description>Displays body content only if the current Subject (user)
       'has' (implies) the specified permission (i.e the user has the specified ability).
@@ -48,7 +48,7 @@
 
   <tag>
     <name>lacksPermission</name>
-    <tag-class>org.apache.ki.web.tags.LacksPermissionTag</tag-class>
+    <tag-class>org.apache.shiro.web.tags.LacksPermissionTag</tag-class>
     <body-content>JSP</body-content>
     <description>Displays body content only if the current Subject (user) does
       NOT have (not imply) the specified permission (i.e. the user lacks the specified ability)
@@ -62,7 +62,7 @@
 
   <tag>
     <name>hasRole</name>
-    <tag-class>org.apache.ki.web.tags.HasRoleTag</tag-class>
+    <tag-class>org.apache.shiro.web.tags.HasRoleTag</tag-class>
     <body-content>JSP</body-content>
     <description>Displays body content only if the current user has the specified role.</description>
     <attribute>
@@ -75,7 +75,7 @@
 
   <tag>
     <name>hasAnyRoles</name>
-    <tag-class>org.apache.ki.web.tags.HasAnyRolesTag</tag-class>
+    <tag-class>org.apache.shiro.web.tags.HasAnyRolesTag</tag-class>
     <body-content>JSP</body-content>
     <description>Displays body content only if the current user has one of the specified roles from a
       comma-separated list of role names.
@@ -89,7 +89,7 @@
 
   <tag>
     <name>lacksRole</name>
-    <tag-class>org.apache.ki.web.tags.LacksRoleTag</tag-class>
+    <tag-class>org.apache.shiro.web.tags.LacksRoleTag</tag-class>
     <body-content>JSP</body-content>
     <description>Displays body content only if the current user does NOT have the specified role
       (i.e. they explicitly lack the specified role)
@@ -103,7 +103,7 @@
 
   <tag>
     <name>authenticated</name>
-    <tag-class>org.apache.ki.web.tags.AuthenticatedTag</tag-class>
+    <tag-class>org.apache.shiro.web.tags.AuthenticatedTag</tag-class>
     <body-content>JSP</body-content>
     <description>Displays body content only if the current user has successfully authenticated
       _during their current session_. It is more restrictive than the 'user' tag.
@@ -113,7 +113,7 @@
 
   <tag>
     <name>notAuthenticated</name>
-    <tag-class>org.apache.ki.web.tags.NotAuthenticatedTag</tag-class>
+    <tag-class>org.apache.shiro.web.tags.NotAuthenticatedTag</tag-class>
     <body-content>JSP</body-content>
     <description>Displays body content only if the current user has NOT succesfully authenticated
       _during their current session_. It is logically opposite to the 'authenticated' tag.
@@ -122,7 +122,7 @@
 
   <tag>
     <name>user</name>
-    <tag-class>org.apache.ki.web.tags.UserTag</tag-class>
+    <tag-class>org.apache.shiro.web.tags.UserTag</tag-class>
     <body-content>JSP</body-content>
     <description>Displays body content only if the current Subject has a known identity, either
       from a previous login or from 'RememberMe' services. Note that this is semantically different
@@ -133,7 +133,7 @@
 
   <tag>
     <name>guest</name>
-    <tag-class>org.apache.ki.web.tags.GuestTag</tag-class>
+    <tag-class>org.apache.shiro.web.tags.GuestTag</tag-class>
     <body-content>JSP</body-content>
     <description>Displays body content only if the current Subject IS NOT known to the system, either
       because they have not logged in or they have no corresponding 'RememberMe' identity. It is logically
@@ -143,7 +143,7 @@
 
   <tag>
     <name>principal</name>
-    <tag-class>org.apache.ki.web.tags.PrincipalTag</tag-class>
+    <tag-class>org.apache.shiro.web.tags.PrincipalTag</tag-class>
     <body-content>JSP</body-content>
     <description>Displays the user's principal or a property of the user's principal.</description>
     <attribute>

Propchange: incubator/shiro/trunk/web/src/main/resources/META-INF/shiro.tld
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: incubator/shiro/trunk/web/src/main/resources/META-INF/shiro.tld
------------------------------------------------------------------------------
    svn:keywords = Author Date Id Revision

Modified: incubator/shiro/trunk/web/src/test/java/org/apache/shiro/web/DefaultWebSecurityManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/web/src/test/java/org/apache/shiro/web/DefaultWebSecurityManagerTest.java?rev=785881&r1=785781&r2=785881&view=diff
==============================================================================
--- incubator/shiro/trunk/web/src/test/java/org/apache/shiro/web/DefaultWebSecurityManagerTest.java (original)
+++ incubator/shiro/trunk/web/src/test/java/org/apache/shiro/web/DefaultWebSecurityManagerTest.java Thu Jun 18 03:13:34 2009
@@ -16,14 +16,14 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.ki.web;
+package org.apache.shiro.web;
 
 import org.junit.After;
 import org.junit.Before;
 import org.junit.Test;
 
-import org.apache.ki.util.ThreadContext;
-import org.apache.ki.web.DefaultWebSecurityManager;
+import org.apache.shiro.util.ThreadContext;
+import org.apache.shiro.web.DefaultWebSecurityManager;
 
 /**
  * @author Les Hazlewood

Modified: incubator/shiro/trunk/web/src/test/java/org/apache/shiro/web/WebRememberMeManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/web/src/test/java/org/apache/shiro/web/WebRememberMeManagerTest.java?rev=785881&r1=785781&r2=785881&view=diff
==============================================================================
--- incubator/shiro/trunk/web/src/test/java/org/apache/shiro/web/WebRememberMeManagerTest.java (original)
+++ incubator/shiro/trunk/web/src/test/java/org/apache/shiro/web/WebRememberMeManagerTest.java Thu Jun 18 03:13:34 2009
@@ -16,13 +16,13 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.ki.web;
+package org.apache.shiro.web;
 
-import org.apache.ki.authc.AuthenticationInfo;
-import org.apache.ki.authc.SimpleAuthenticationInfo;
-import org.apache.ki.authc.UsernamePasswordToken;
-import org.apache.ki.subject.PrincipalCollection;
-import org.apache.ki.subject.SimplePrincipalCollection;
+import org.apache.shiro.authc.AuthenticationInfo;
+import org.apache.shiro.authc.SimpleAuthenticationInfo;
+import org.apache.shiro.authc.UsernamePasswordToken;
+import org.apache.shiro.subject.PrincipalCollection;
+import org.apache.shiro.subject.SimplePrincipalCollection;
 import static org.easymock.EasyMock.*;
 import static org.junit.Assert.assertTrue;
 import org.junit.Test;
@@ -58,7 +58,7 @@
         mgr.onSuccessfulLogin(token, account);
     }
 
-    // KI-69  @Test
+    // SHIRO-69  @Test
     public void getRememberedPrincipals() {
         HttpServletRequest mockRequest = createMock(HttpServletRequest.class);
         WebUtils.bind(mockRequest);
@@ -85,7 +85,7 @@
         assertTrue(collection.iterator().next().equals("user"));
     }
 
-    // KI-69  @Test
+    // SHIRO-69  @Test
     public void getRememberedPrincipalsDecryptionError() {
         HttpServletRequest mockRequest = createMock(HttpServletRequest.class);
         WebUtils.bind(mockRequest);

Modified: incubator/shiro/trunk/web/src/test/java/org/apache/shiro/web/attr/CookieAttributeTest.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/web/src/test/java/org/apache/shiro/web/attr/CookieAttributeTest.java?rev=785881&r1=785781&r2=785881&view=diff
==============================================================================
--- incubator/shiro/trunk/web/src/test/java/org/apache/shiro/web/attr/CookieAttributeTest.java (original)
+++ incubator/shiro/trunk/web/src/test/java/org/apache/shiro/web/attr/CookieAttributeTest.java Thu Jun 18 03:13:34 2009
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.ki.web.attr;
+package org.apache.shiro.web.attr;
 
 import javax.servlet.http.Cookie;
 import javax.servlet.http.HttpServletRequest;
@@ -28,7 +28,7 @@
 import org.junit.Before;
 import org.junit.Test;
 
-import org.apache.ki.web.attr.CookieAttribute;
+import org.apache.shiro.web.attr.CookieAttribute;
 
 
 /**

Modified: incubator/shiro/trunk/web/src/test/java/org/apache/shiro/web/filter/authz/HostFilterTest.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/web/src/test/java/org/apache/shiro/web/filter/authz/HostFilterTest.java?rev=785881&r1=785781&r2=785881&view=diff
==============================================================================
--- incubator/shiro/trunk/web/src/test/java/org/apache/shiro/web/filter/authz/HostFilterTest.java (original)
+++ incubator/shiro/trunk/web/src/test/java/org/apache/shiro/web/filter/authz/HostFilterTest.java Thu Jun 18 03:13:34 2009
@@ -16,7 +16,7 @@
  * specific language governing permissions and limitations
  * under the License.
  */
-package org.apache.ki.web.filter.authz;
+package org.apache.shiro.web.filter.authz;
 
 import org.junit.Test;
 import static org.junit.Assert.*;

Added: incubator/shiro/trunk/web/src/test/java/org/apache/shiro/web/servlet/ShiroFilterTest.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/web/src/test/java/org/apache/shiro/web/servlet/ShiroFilterTest.java?rev=785881&view=auto
==============================================================================
--- incubator/shiro/trunk/web/src/test/java/org/apache/shiro/web/servlet/ShiroFilterTest.java (added)
+++ incubator/shiro/trunk/web/src/test/java/org/apache/shiro/web/servlet/ShiroFilterTest.java Thu Jun 18 03:13:34 2009
@@ -0,0 +1,86 @@
+/*
+ * 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.servlet;
+
+import javax.servlet.FilterConfig;
+import javax.servlet.ServletContext;
+
+import static org.easymock.EasyMock.*;
+import org.junit.Test;
+
+import org.apache.shiro.web.servlet.ShiroFilter;
+
+
+/**
+ * @author Les Hazlewood
+ * @since 0.9
+ */
+public class ShiroFilterTest
+{
+
+    private ShiroFilter filter;
+    private FilterConfig mockFilterConfig;
+    private ServletContext mockServletContext;
+
+    protected void setUp(String config) {
+        mockFilterConfig = createMock(FilterConfig.class);
+        mockServletContext = createMock(ServletContext.class);
+
+        expect(mockFilterConfig.getServletContext()).andReturn(mockServletContext);
+        expect(mockFilterConfig.getInitParameter(ShiroFilter.CONFIG_CLASS_NAME_INIT_PARAM_NAME)).andReturn(null).once();
+        expect(mockFilterConfig.getInitParameter(ShiroFilter.CONFIG_INIT_PARAM_NAME)).andReturn(config).once();
+        expect(mockFilterConfig.getInitParameter(ShiroFilter.CONFIG_URL_INIT_PARAM_NAME)).andReturn(null).once();
+    }
+
+    public void tearDown() throws Exception {
+        reset(mockServletContext);
+        reset(mockFilterConfig);
+
+        replay(mockServletContext);
+
+        //this.filter.destroy();
+
+        verify(mockServletContext);
+        verify(mockFilterConfig);
+    }
+
+    protected void replayAndVerify() throws Exception {
+        replay(mockServletContext);
+        replay(mockFilterConfig);
+
+        this.filter = new ShiroFilter();
+        this.filter.init(mockFilterConfig);
+
+        verify(mockFilterConfig);
+        verify(mockServletContext);
+    }
+
+
+    @Test
+    public void testDefaultConfig() throws Exception {
+        setUp(null);
+        replayAndVerify();
+    }
+
+    @Test
+    public void testSimpleConfig() throws Exception {
+        setUp("[filters]\nauthc.successUrl = /index.jsp");
+        replayAndVerify();
+    }
+}