[jboss-cvs] Picketbox SVN: r444 - trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Fri Aug 30 10:25:14 EDT 2013
Author: sguilhen at redhat.com
Date: 2013-08-30 10:25:14 -0400 (Fri, 30 Aug 2013)
New Revision: 444
Modified:
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/DatabaseCertLoginModule.java
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/DatabaseServerLoginModule.java
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/DbUtil.java
trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/Util.java
Log:
SECURITY-750 Changed DBUtils.getRolesSets() method to receive the TxManagerJNDIName as a parameter
Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/DatabaseCertLoginModule.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/DatabaseCertLoginModule.java 2013-08-30 14:23:00 UTC (rev 443)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/DatabaseCertLoginModule.java 2013-08-30 14:25:14 UTC (rev 444)
@@ -48,15 +48,18 @@
private static final String DS_JNDI_NAME = "dsJndiName";
private static final String ROLES_QUERY = "rolesQuery";
private static final String SUSPEND_RESUME = "suspendResume";
+ private static final String TRANSACTION_MANAGER_JNDI_NAME = "transactionManagerJndiName";
- private static final String[] ALL_VALID_OPTIONS =
+ private static final String[] ALL_VALID_OPTIONS =
{
DS_JNDI_NAME,ROLES_QUERY,SUSPEND_RESUME
};
/** The JNDI name of the DataSource to use */
private String dsJndiName;
- /** The sql query to obtain the user roles */
+ /** The JNDI name of the transaction manager */
+ protected String txManagerJndiName = "java:/TransactionManager";
+ /** The sql query to obtain the user roles */
private String rolesQuery = "select Role, RoleGroup from Roles where PrincipalID=?";
/** Whether to suspend resume transactions during database operations */
protected boolean suspendResume = true;
@@ -85,6 +88,10 @@
if( tmp != null )
suspendResume = Boolean.valueOf(tmp.toString()).booleanValue();
+ tmp = options.get(TRANSACTION_MANAGER_JNDI_NAME);
+ if (tmp != null)
+ txManagerJndiName = tmp.toString();
+
PicketBoxLogger.LOGGER.traceDBCertLoginModuleOptions(dsJndiName, "", rolesQuery, suspendResume);
}
@@ -94,7 +101,7 @@
protected Group[] getRoleSets() throws LoginException
{
String username = getUsername();
- Group[] roleSets = Util.getRoleSets(username, dsJndiName, rolesQuery, this, suspendResume);
+ Group[] roleSets = Util.getRoleSets(username, dsJndiName, txManagerJndiName, rolesQuery, this, suspendResume);
return roleSets;
}
Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/DatabaseServerLoginModule.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/DatabaseServerLoginModule.java 2013-08-30 14:23:00 UTC (rev 443)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/DatabaseServerLoginModule.java 2013-08-30 14:25:14 UTC (rev 444)
@@ -91,9 +91,9 @@
protected String rolesQuery;
/** Whether to suspend resume transactions during database operations */
protected boolean suspendResume = true;
-
- protected String TX_MGR_JNDI_NAME = "java:/TransactionManager";
-
+ /** The JNDI name of the transaction manager */
+ protected String txManagerJndiName = "java:/TransactionManager";
+ /** The TransactionManagaer instance to be used */
protected TransactionManager tm = null;
/**
@@ -128,7 +128,7 @@
//Get the Transaction Manager JNDI Name
String jname = (String) options.get(TRANSACTION_MANAGER_JNDI_NAME);
if(jname != null)
- this.TX_MGR_JNDI_NAME = jname;
+ this.txManagerJndiName = jname;
PicketBoxLogger.LOGGER.traceDBCertLoginModuleOptions(dsJndiName, principalsQuery, rolesQuery, suspendResume);
@@ -259,7 +259,7 @@
{
String username = getUsername();
PicketBoxLogger.LOGGER.traceExecuteQuery(rolesQuery, username);
- Group[] roleSets = Util.getRoleSets(username, dsJndiName, rolesQuery, this,
+ Group[] roleSets = Util.getRoleSets(username, dsJndiName, txManagerJndiName, rolesQuery, this,
suspendResume);
return roleSets;
}
@@ -280,6 +280,6 @@
protected TransactionManager getTransactionManager() throws NamingException
{
TransactionManagerLocator tml = new TransactionManagerLocator();
- return tml.getTM(this.TX_MGR_JNDI_NAME);
+ return tml.getTM(this.txManagerJndiName);
}
}
Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/DbUtil.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/DbUtil.java 2013-08-30 14:23:00 UTC (rev 443)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/DbUtil.java 2013-08-30 14:25:14 UTC (rev 444)
@@ -54,7 +54,7 @@
@return Group[] containing the sets of roles
*/
- static Group[] getRoleSets(String username, String dsJndiName,
+ static Group[] getRoleSets(String username, String dsJndiName, String txManagerJndiName,
String rolesQuery, AbstractServerLoginModule aslm, boolean suspendResume)
throws LoginException
{
@@ -70,7 +70,7 @@
TransactionManagerLocator tml = new TransactionManagerLocator();
try
{
- tm = tml.getTM("java:/TransactionManager");
+ tm = tml.getTM(txManagerJndiName);
}
catch (NamingException e1)
{
Modified: trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/Util.java
===================================================================
--- trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/Util.java 2013-08-30 14:23:00 UTC (rev 443)
+++ trunk/security-jboss-sx/jbosssx/src/main/java/org/jboss/security/auth/spi/Util.java 2013-08-30 14:25:14 UTC (rev 444)
@@ -130,11 +130,11 @@
@return Group[] containing the sets of roles
*/
- static Group[] getRoleSets(String username, String dsJndiName,
+ static Group[] getRoleSets(String username, String dsJndiName, String txManagerJndiName,
String rolesQuery, AbstractServerLoginModule aslm)
throws LoginException
{
- return getRoleSets(username, dsJndiName, rolesQuery, aslm, false);
+ return getRoleSets(username, dsJndiName, txManagerJndiName, rolesQuery, aslm, false);
}
/** Execute the rolesQuery against the dsJndiName to obtain the roles for
@@ -142,11 +142,11 @@
@return Group[] containing the sets of roles
*/
- static Group[] getRoleSets(String username, String dsJndiName,
+ static Group[] getRoleSets(String username, String dsJndiName, String txManagerJndiName,
String rolesQuery, AbstractServerLoginModule aslm, boolean suspendResume)
throws LoginException
{
- return DbUtil.getRoleSets(username, dsJndiName, rolesQuery, aslm, suspendResume);
+ return DbUtil.getRoleSets(username, dsJndiName, txManagerJndiName, rolesQuery, aslm, suspendResume);
}
/** Utility method which loads the given properties file and returns a
More information about the jboss-cvs-commits
mailing list