[jboss-cvs] JBossAS SVN: r110354 - projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/main/java/org/jboss/security/auth/spi.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Thu Jan 13 14:02:09 EST 2011
Author: mmoyses
Date: 2011-01-13 14:02:09 -0500 (Thu, 13 Jan 2011)
New Revision: 110354
Modified:
projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/main/java/org/jboss/security/auth/spi/LdapExtLoginModule.java
Log:
SECURITY-552: adding option to parse username
Modified: projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/main/java/org/jboss/security/auth/spi/LdapExtLoginModule.java
===================================================================
--- projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/main/java/org/jboss/security/auth/spi/LdapExtLoginModule.java 2011-01-13 16:01:20 UTC (rev 110353)
+++ projects/security/security-jboss-sx/branches/Branch_2_0/jbosssx/src/main/java/org/jboss/security/auth/spi/LdapExtLoginModule.java 2011-01-13 19:02:09 UTC (rev 110354)
@@ -170,6 +170,12 @@
private static final String SECURITY_DOMAIN_OPT = "jaasSecurityDomain";
private static final String DISTINGUISHED_NAME_ATTRIBUTE_OPT = "distinguishedNameAttribute";
+
+ private static final String PARSE_USERNAME = "parseUsername";
+
+ private static final String USERNAME_BEGIN_STRING = "usernameBeginString";
+
+ private static final String USERNAME_END_STRING = "usernameEndString";
protected String bindDN;
@@ -197,6 +203,12 @@
protected String distinguishedNameAttribute;
+ protected boolean parseUsername;
+
+ protected String usernameBeginString;
+
+ protected String usernameEndString;
+
// simple flag to indicate is the validatePassword method was called
protected boolean isPasswordValidated = false;
@@ -657,4 +669,24 @@
}
}
}
+
+ protected String getUsername()
+ {
+ String username = super.getUsername();
+ parseUsername = Boolean.valueOf((String) options.get(PARSE_USERNAME));
+ if (parseUsername)
+ {
+ usernameBeginString = (String) options.get(USERNAME_BEGIN_STRING);
+ usernameEndString = (String) options.get(USERNAME_END_STRING);
+ int beginIndex = 0;
+ if (usernameBeginString != null && !usernameBeginString.equals(""))
+ beginIndex = username.indexOf(usernameBeginString) + usernameBeginString.length();
+ int endIndex = username.length();
+ if (usernameEndString != null && !usernameEndString.equals(""))
+ endIndex = username.indexOf(usernameEndString);
+ username = username.substring(beginIndex, endIndex);
+ }
+ return username;
+ }
+
}
More information about the jboss-cvs-commits
mailing list