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 2018/04/02 22:38:47 UTC
[2/5] shiro git commit: cleaned up documentation / removed unused code
cleaned up documentation / removed unused code
Project: http://git-wip-us.apache.org/repos/asf/shiro/repo
Commit: http://git-wip-us.apache.org/repos/asf/shiro/commit/f66ce5a7
Tree: http://git-wip-us.apache.org/repos/asf/shiro/tree/f66ce5a7
Diff: http://git-wip-us.apache.org/repos/asf/shiro/diff/f66ce5a7
Branch: refs/heads/master
Commit: f66ce5a7fb1e09eff256b266bd7890afa7444037
Parents: 523dd73
Author: claude <cl...@claude-XPS-15-9560>
Authored: Tue Jan 9 11:07:35 2018 +0000
Committer: claude <cl...@claude-XPS-15-9560>
Committed: Tue Jan 9 11:07:35 2018 +0000
----------------------------------------------------------------------
.../org/apache/shiro/realm/text/IniRealm.java | 7 ++++--
.../realm/text/TextConfigurationRealm.java | 21 ++++++++++++++++-
.../realm/text/TextConfigurationRealmTest.java | 24 ++------------------
3 files changed, 27 insertions(+), 25 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/shiro/blob/f66ce5a7/core/src/main/java/org/apache/shiro/realm/text/IniRealm.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/shiro/realm/text/IniRealm.java b/core/src/main/java/org/apache/shiro/realm/text/IniRealm.java
index 2d440c0..15773e7 100644
--- a/core/src/main/java/org/apache/shiro/realm/text/IniRealm.java
+++ b/core/src/main/java/org/apache/shiro/realm/text/IniRealm.java
@@ -29,11 +29,14 @@ import org.slf4j.LoggerFactory;
* {@link org.apache.shiro.authc.SimpleAccount SimpleAccount} instances based on
* {@link Ini} configuration.
* <p/>
- * This implementation looks for two {@link Ini.Section sections} in the {@code Ini} configuration:
+ * This implementation looks for three {@link Ini.Section sections} in the {@code Ini} configuration:
* <pre>
* [users]
* # One or more {@link org.apache.shiro.realm.text.TextConfigurationRealm#setUserDefinitions(String) user definitions}
* ...
+ * [roles_config]
+ * # One or more {@link org.apache.shiro.realm.text.TextConfigurationRealm#setRoleConfigDefinitions(String) role configuration definitions}
+ * ...
* [roles]
* # One or more {@link org.apache.shiro.realm.text.TextConfigurationRealm#setRoleDefinitions(String) role definitions}</pre>
* <p/>
@@ -46,7 +49,7 @@ public class IniRealm extends TextConfigurationRealm {
public static final String USERS_SECTION_NAME = "users";
public static final String ROLES_SECTION_NAME = "roles";
- public static final String ROLES_CONFIG_SECTION_NAME = "roles.config";
+ public static final String ROLES_CONFIG_SECTION_NAME = "roles_config";
private static transient final Logger log = LoggerFactory.getLogger(IniRealm.class);
http://git-wip-us.apache.org/repos/asf/shiro/blob/f66ce5a7/core/src/main/java/org/apache/shiro/realm/text/TextConfigurationRealm.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/shiro/realm/text/TextConfigurationRealm.java b/core/src/main/java/org/apache/shiro/realm/text/TextConfigurationRealm.java
index d04e8b6..c2ef3fe 100644
--- a/core/src/main/java/org/apache/shiro/realm/text/TextConfigurationRealm.java
+++ b/core/src/main/java/org/apache/shiro/realm/text/TextConfigurationRealm.java
@@ -134,6 +134,25 @@ public class TextConfigurationRealm extends SimpleAccountRealm {
return roleConfigDefinitions;
}
+ /**
+ * Sets a newline (\n) delimited String that defines role configuration definitions.
+ * <p/>
+ * <p>Each line in the string must be one of the following name value pairs:</p>
+ * <p/>
+ * <p><code><em>permissionResolver</em> = <em>PermissionResolverClass</em></code></p>
+ * <p/>
+ * <p>where <em>permissionsResolverClass</em> is the name of a class implementing PermissionResolver interface
+ * and that has a no-argument constructor. If not set the WildCardPermissionsResolver is used.</p>
+ * <p/>
+ *
+ * <p><code><em>caseSensitiveWildCardPermissions</em> = <em>true</em></code></p>
+ * <p/>
+ * <p>Sets the cases sensitive flag on the default WildCardPermissionsResolver. Using this paramter
+ * has the side effect of resetting the permissionsResolver to WildCardPermissionsResolver.
+ * <p/>
+ *
+ * @param roleConfigDefinitions the role configuration options to be parsed at initialization
+ */
public void setRoleConfigDefinitions(String roleConfigDefinitions)
{
this.roleConfigDefinitions = roleConfigDefinitions;
@@ -165,7 +184,7 @@ public class TextConfigurationRealm extends SimpleAccountRealm {
}
for (String cfgOption : roleDefs.keySet()) {
// use a no-arg permission resolver.
- if (cfgOption.equals( "permissionsResolver" ))
+ if (cfgOption.equals( "permissionResolver" ))
{
try {
Class<?> clazz = Thread.currentThread().getContextClassLoader().loadClass( roleDefs.get(cfgOption) );
http://git-wip-us.apache.org/repos/asf/shiro/blob/f66ce5a7/core/src/test/java/org/apache/shiro/realm/text/TextConfigurationRealmTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/shiro/realm/text/TextConfigurationRealmTest.java b/core/src/test/java/org/apache/shiro/realm/text/TextConfigurationRealmTest.java
index 6dae812..2a0892a 100644
--- a/core/src/test/java/org/apache/shiro/realm/text/TextConfigurationRealmTest.java
+++ b/core/src/test/java/org/apache/shiro/realm/text/TextConfigurationRealmTest.java
@@ -255,17 +255,7 @@ public class TextConfigurationRealmTest {
public void testProcessRoleConfigurationDefinitions_caseSensitive() throws InterruptedException {
realm = new TestRealm() {
public void test(Thread runnable) throws InterruptedException {
-// // While the realm's lock is held by this thread user definitions cannot be processed
-// // Obtain the realm's locks
-// USERS_LOCK.writeLock().lock();
-// try {
runnable.start();
-// Thread.sleep(500);
-// // No account until lock is released and user definitions are processed
-// assertFalse("account exists when it shouldn't", realm.accountExists("user1"));
-// } finally {
-// USERS_LOCK.writeLock().unlock();
-// }
}
};
TestThread testThread = new TestThread(new Runnable() {
@@ -291,17 +281,7 @@ public class TextConfigurationRealmTest {
public void testProcessRoleConfigurationDefinitions_PermissionResolver() throws InterruptedException {
realm = new TestRealm() {
public void test(Thread runnable) throws InterruptedException {
-// // While the realm's lock is held by this thread user definitions cannot be processed
-// // Obtain the realm's locks
-// USERS_LOCK.writeLock().lock();
-// try {
- runnable.start();
-// Thread.sleep(500);
-// // No account until lock is released and user definitions are processed
-// assertFalse("account exists when it shouldn't", realm.accountExists("user1"));
-// } finally {
-// USERS_LOCK.writeLock().unlock();
-// }
+ runnable.start();
}
};
TestThread testThread = new TestThread(new Runnable() {
@@ -313,7 +293,7 @@ public class TextConfigurationRealmTest {
}
}
});
- realm.setRoleConfigDefinitions( "permissionsResolver="+TestPermissionResolver.class.getName() );
+ realm.setRoleConfigDefinitions( "permissionResolver="+TestPermissionResolver.class.getName() );
Thread testTask = new Thread(testThread);
realm.test(testTask);
testTask.join(500);