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/12/18 21:53:21 UTC
svn commit: r892379 - in /incubator/shiro/trunk:
core/src/main/java/org/apache/shiro/mgt/SubjectFactory.java
core/src/main/java/org/apache/shiro/util/ThreadContext.java
samples/web/src/main/webapp/WEB-INF/web.xml
samples/web/src/main/webapp/home.jsp
Author: lhazlewood
Date: Fri Dec 18 20:53:21 2009
New Revision: 892379
URL: http://svn.apache.org/viewvc?rev=892379&view=rev
Log:
Deprecated 2 constants, cleaned up the sample webapp to use the .ini configuration for users/roles instead of the older PropertiesRealm
Modified:
incubator/shiro/trunk/core/src/main/java/org/apache/shiro/mgt/SubjectFactory.java
incubator/shiro/trunk/core/src/main/java/org/apache/shiro/util/ThreadContext.java
incubator/shiro/trunk/samples/web/src/main/webapp/WEB-INF/web.xml
incubator/shiro/trunk/samples/web/src/main/webapp/home.jsp
Modified: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/mgt/SubjectFactory.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/core/src/main/java/org/apache/shiro/mgt/SubjectFactory.java?rev=892379&r1=892378&r2=892379&view=diff
==============================================================================
--- incubator/shiro/trunk/core/src/main/java/org/apache/shiro/mgt/SubjectFactory.java (original)
+++ incubator/shiro/trunk/core/src/main/java/org/apache/shiro/mgt/SubjectFactory.java Fri Dec 18 20:53:21 2009
@@ -46,7 +46,11 @@
public static final String HOST = SubjectFactory.class.getName() + ".HOST";
- public static final String INET_ADDRESS = SubjectFactory.class.getName() + ".INET_ADDRESS";
+ /**
+ * @deprecated use the {@link #HOST HOST} key instead. This will be removed prior to 1.0.
+ */
+ @Deprecated
+ public static final String INET_ADDRESS = HOST;
public static final String SERVLET_REQUEST = SubjectFactory.class.getName() + ".SERVLET_REQUEST";
Modified: incubator/shiro/trunk/core/src/main/java/org/apache/shiro/util/ThreadContext.java
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/core/src/main/java/org/apache/shiro/util/ThreadContext.java?rev=892379&r1=892378&r2=892379&view=diff
==============================================================================
--- incubator/shiro/trunk/core/src/main/java/org/apache/shiro/util/ThreadContext.java (original)
+++ incubator/shiro/trunk/core/src/main/java/org/apache/shiro/util/ThreadContext.java Fri Dec 18 20:53:21 2009
@@ -55,6 +55,11 @@
public static final String SECURITY_MANAGER_KEY = ThreadContext.class.getName() + "_SECURITY_MANAGER_KEY";
public static final String SUBJECT_KEY = ThreadContext.class.getName() + "_SUBJECT_KEY";
public static final String SESSION_ID_KEY = ThreadContext.class.getName() + "_SESSION_ID_KEY";
+
+ /**
+ * @deprecated will be removed before 1.0
+ */
+ @Deprecated
public static final String HOST_KEY = ThreadContext.class.getName() + "_INET_ADDRESS_KEY";
protected static ThreadLocal<Map<Object, Object>> resources =
Modified: incubator/shiro/trunk/samples/web/src/main/webapp/WEB-INF/web.xml
URL: http://svn.apache.org/viewvc/incubator/shiro/trunk/samples/web/src/main/webapp/WEB-INF/web.xml?rev=892379&r1=892378&r2=892379&view=diff
==============================================================================
--- incubator/shiro/trunk/samples/web/src/main/webapp/WEB-INF/web.xml (original)
+++ incubator/shiro/trunk/samples/web/src/main/webapp/WEB-INF/web.xml Fri Dec 18 20:53:21 2009
@@ -30,11 +30,27 @@
<param-value>
# The IniShiroFilter configuration is very powerful and flexible, while still remaining succinct.
- # Please read the comprehensive example, with full comments and explanations, in the
- # org.apache.shiro.web.servlet.IniShiroFilter JavaDoc
+ # Please read the org.apache.shiro.web.servlet.IniShiroFilter JavaDoc for information.
- [main]
- demoRealm = org.apache.shiro.realm.text.PropertiesRealm
+ # Quick Tip: Instead of having this configuration here in web.xml, you can instead
+ # move all of this to a 'shiro.ini' file at the root of the classpath and remove
+ # the 'config' init-param. Or you can specify the 'configPath' init-param and specify the
+ # path to a resource at any location (url, file or classpath). This may be desired if the
+ # config gets long and you want to keep web.xml clean.
+
+ [users]
+ # format: username = password, role1, role2, ..., roleN
+ root = secret,admin
+ guest = guest,guest
+ presidentskroob = 12345,president
+ darkhelmet = ludicrousspeed,darklord,schwartz
+ lonestarr = vespa,goodguy,schwartz
+
+ [roles]
+ # format; roleName = permission1, permission2, ..., permissionN
+ admin = *
+ schwartz = lightsaber:*
+ goodguy = winnebago:drive:eagle5
[filters]
shiro.loginUrl = /login.jsp
@@ -47,7 +63,7 @@
/login.jsp = authc
/account/** = authc
- /remoting/** = authc, roles[b2bClient], perms[remote:invoke:"lan,wan"]
+ /remoting/** = authc, roles[b2bClient], perms["remote:invoke:lan,wan"]
</param-value>
</init-param>
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=892379&r1=892378&r2=892379&view=diff
==============================================================================
--- incubator/shiro/trunk/samples/web/src/main/webapp/home.jsp (original)
+++ incubator/shiro/trunk/samples/web/src/main/webapp/home.jsp Fri Dec 18 20:53:21 2009
@@ -47,7 +47,7 @@
<h3>Roles you have</h3>
<p>
- <shiro:hasRole name="root">root<br/></shiro:hasRole>
+ <shiro:hasRole name="admin">admin<br/></shiro:hasRole>
<shiro:hasRole name="president">president<br/></shiro:hasRole>
<shiro:hasRole name="darklord">darklord<br/></shiro:hasRole>
<shiro:hasRole name="goodguy">goodguy<br/></shiro:hasRole>
@@ -57,7 +57,7 @@
<h3>Roles you DON'T have</h3>
<p>
- <shiro:lacksRole name="root">root<br/></shiro:lacksRole>
+ <shiro:lacksRole name="admin">admin<br/></shiro:lacksRole>
<shiro:lacksRole name="president">president<br/></shiro:lacksRole>
<shiro:lacksRole name="darklord">darklord<br/></shiro:lacksRole>
<shiro:lacksRole name="goodguy">goodguy<br/></shiro:lacksRole>