From: Scott M S. <st...@us...> - 2004-07-30 23:20:36
|
User: starksm Date: 04/07/30 16:20:29 Modified: src/main/org/jboss/security/auth/spi UsersRolesLoginModule.java Log: Add a roleGroupSeperator option to externalize the character used to seperate the role group name from the username e.g., '.' in jduke.CallerPrincipal=... Revision Changes Path 1.16 +10 -2 jbosssx/src/main/org/jboss/security/auth/spi/UsersRolesLoginModule.java Index: UsersRolesLoginModule.java =================================================================== RCS file: /cvsroot/jboss/jbosssx/src/main/org/jboss/security/auth/spi/UsersRolesLoginModule.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- UsersRolesLoginModule.java 26 May 2004 21:07:17 -0000 1.15 +++ UsersRolesLoginModule.java 30 Jul 2004 23:20:29 -0000 1.16 @@ -23,7 +23,6 @@ import javax.security.auth.login.LoginException; import org.jboss.security.SimpleGroup; -import org.jboss.security.auth.spi.UsernamePasswordLoginModule; import org.jboss.logging.Logger; /** A simple properties file based login module that consults two Java Properties @@ -67,6 +66,10 @@ private Properties users; /** The roles.properties mappings */ private Properties roles; + /** The character used to seperate the role group name from the username + * e.g., '.' in jduke.CallerPrincipal=... + */ + private char roleGroupSeperator = '.'; /** Initialize this LoginModule. *@param options - the login module option map. Supported options include: @@ -74,6 +77,8 @@ user/passwords. The default is "users.properties" *rolesProperties: The name of the properties resource containing user/roles The default is "roles.properties". + *roleGroupSeperator: The character used to seperate the role group name from + the username e.g., '.' in jduke.CallerPrincipal=... . The default = '.'. */ public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) @@ -88,6 +93,9 @@ option = (String) options.get("rolesProperties"); if (option != null) rolesRsrcName = option; + option = (String) options.get("roleGroupSeperator"); + if( option != null ) + roleGroupSeperator = option.charAt(0); // Load the properties file that contains the list of users and passwords loadUsers(); loadRoles(); @@ -133,7 +141,7 @@ String user = (String) users.nextElement(); String value = roles.getProperty(user); // See if this entry is of the form targetUser[.GroupName]=roles - int index = user.indexOf('.'); + int index = user.indexOf(roleGroupSeperator); boolean isRoleGroup = false; boolean userMatch = false; if (index > 0 && targetUser.regionMatches(0, user, 0, index) == true) |