User: stark
Date: 01/01/23 18:59:40
Modified: src/main/org/jboss/security ClientLoginModule.java
Log:
When the multi-threaded option is set to true, the SecurityAssociation.setServer()
so that each login thread has its own principal and credential storage. This
avoids exposing the SecurityAssociation class to users who uses multiple
login threads.
Revision Changes Path
1.6 +20 -0 jboss/src/main/org/jboss/security/ClientLoginModule.java
Index: ClientLoginModule.java
===================================================================
RCS file:
/products/cvs/ejboss/jboss/src/main/org/jboss/security/ClientLoginModule.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- ClientLoginModule.java 2001/01/23 02:24:02 1.5
+++ ClientLoginModule.java 2001/01/24 02:59:40 1.6
@@ -18,7 +18,19 @@
import javax.security.auth.login.LoginException;
import javax.security.auth.spi.LoginModule;
+/** A simple implementation of LoginModule for use by JBoss clients for
+the establishment of the caller identity and credentials. This simply sets
+the SecurityAssociation principal to the value of the NameCallback
+filled in by the CallbackHandler, and the SecurityAssociation credential
+to the value of the PasswordCallback filled in by the CallbackHandler.
+It has one option: multi-threaded=[true|false]
+When the multi-threaded option is set to true, the SecurityAssociation.setServer()
+so that each login thread has its own principal and credential storage.
+
+@author <a href="mailto:[EMAIL PROTECTED]">Oleg Nitz</a>
+@author [EMAIL PROTECTED]
+*/
public class ClientLoginModule implements LoginModule {
private CallbackHandler _callbackHandler;
@@ -28,6 +40,14 @@
public void initialize(Subject subject, CallbackHandler callbackHandler,
Map sharedState, Map options) {
_callbackHandler = callbackHandler;
+ // Check for multi-threaded option
+ String mt = (String) options.get("multi-threaded");
+ if( mt != null && Boolean.valueOf(mt).booleanValue() == true )
+ { /* Turn on the server mode which uses thread local storage for
+ the principal information.
+ */
+ SecurityAssociation.setServer();
+ }
}
/**