From: Chris G. <ce...@uf...> - 2006-07-10 06:37:17
|
User: j2ee_junkie Date: 06/07/10 02:37:05 Modified: src/main/org/jboss/security Tag: Branch_4_0 AltClientLoginModule.java ClientLoginModule.java Added: src/main/org/jboss/security Tag: Branch_4_0 SecurityConstants.java Log: JBAS-1477: Pass in the security-domain name to the login modules for error reporting Revision Changes Path No revision No revision 1.4.4.2 +25 -8 jbosssx/src/main/org/jboss/security/AltClientLoginModule.java (In the diff below, changes in quantity of whitespace are not shown.) Index: AltClientLoginModule.java =================================================================== RCS file: /cvsroot/jboss/jbosssx/src/main/org/jboss/security/AltClientLoginModule.java,v retrieving revision 1.4.4.1 retrieving revision 1.4.4.2 diff -u -b -r1.4.4.1 -r1.4.4.2 --- AltClientLoginModule.java 29 Oct 2005 05:06:37 -0000 1.4.4.1 +++ AltClientLoginModule.java 10 Jul 2006 06:37:05 -0000 1.4.4.2 @@ -34,6 +34,9 @@ import javax.security.auth.login.LoginException; import javax.security.auth.spi.LoginModule; +import org.jboss.logging.Logger; +import org.jboss.security.SecurityConstants; + /** 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 @@ -57,10 +60,11 @@ </ul> @author Sco...@jb... - @version $Revision: 1.4.4.1 $ + @version $Revision: 1.4.4.2 $ */ public class AltClientLoginModule implements LoginModule { + private static Logger log = Logger.getLogger(AltClientLoginModule.class); private Subject subject; private CallbackHandler callbackHandler; /** Shared state between login modules */ @@ -69,6 +73,7 @@ private boolean useFirstPass; private String username; private char[] password = null; + private boolean trace; /** * Initialize this LoginModule. @@ -76,15 +81,25 @@ public void initialize(Subject subject, CallbackHandler callbackHandler, Map sharedState, Map options) { + this.trace = log.isTraceEnabled(); this.subject = subject; this.callbackHandler = callbackHandler; this.sharedState = sharedState; + + //log securityDomain, if set. + if(trace) + log.trace("Security domain: " + + (String)options.get(SecurityConstants.SECURITY_DOMAIN_OPTION)); + // 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 + if( Boolean.valueOf(mt).booleanValue() == true ) + { + /* Turn on the server mode which uses thread local storage for the principal information. */ + if(trace) + log.trace("Enabling multi-threaded mode"); SecurityAssociationActions.setServer(); } @@ -94,6 +109,8 @@ */ String passwordStacking = (String) options.get("password-stacking"); useFirstPass = passwordStacking != null; + if(trace && useFirstPass) + log.trace("Enabling useFirstPass mode"); } /** 1.7.4.4 +15 -4 jbosssx/src/main/org/jboss/security/ClientLoginModule.java (In the diff below, changes in quantity of whitespace are not shown.) Index: ClientLoginModule.java =================================================================== RCS file: /cvsroot/jboss/jbosssx/src/main/org/jboss/security/ClientLoginModule.java,v retrieving revision 1.7.4.3 retrieving revision 1.7.4.4 diff -u -b -r1.7.4.3 -r1.7.4.4 --- ClientLoginModule.java 19 Feb 2006 02:25:38 -0000 1.7.4.3 +++ ClientLoginModule.java 10 Jul 2006 06:37:05 -0000 1.7.4.4 @@ -21,7 +21,6 @@ */ package org.jboss.security; - import java.io.IOException; import java.security.Principal; import java.util.Map; @@ -36,6 +35,7 @@ import javax.security.auth.spi.LoginModule; import org.jboss.logging.Logger; +import org.jboss.security.SecurityConstants; /** A simple implementation of LoginModule for use by JBoss clients for the establishment of the caller identity and credentials. This simply sets @@ -97,19 +97,28 @@ this.subject = subject; this.callbackHandler = callbackHandler; this.sharedState = sharedState; + + //log securityDomain, if set. + if(trace) + log.trace("Security domain: " + + (String)options.get(SecurityConstants.SECURITY_DOMAIN_OPTION)); + // Check for multi-threaded option String flag = (String) options.get("multi-threaded"); if (Boolean.valueOf(flag).booleanValue() == true) - { /* Turn on the server mode which uses thread local storage for + { + /* Turn on the server mode which uses thread local storage for the principal information. */ - if( trace ) + if(trace) log.trace("Enabling multi-threaded mode"); SecurityAssociationActions.setServer(); } flag = (String) options.get("restore-login-identity"); restoreLoginIdentity = Boolean.valueOf(flag).booleanValue(); + if(trace) + log.trace("Enabling restore-login-identity mode"); /* Check for password sharing options. Any non-null value for password_stacking sets useFirstPass as this module has no way to @@ -117,6 +126,8 @@ */ String passwordStacking = (String) options.get("password-stacking"); useFirstPass = passwordStacking != null; + if(trace && useFirstPass) + log.trace("Enabling useFirstPass mode"); } /** No revision No revision 1.3.2.2 +39 -0 jbosssx/src/main/org/jboss/security/SecurityConstants.java (In the diff below, changes in quantity of whitespace are not shown.) Index: SecurityConstants.java =================================================================== RCS file: SecurityConstants.java diff -N SecurityConstants.java --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ SecurityConstants.java 10 Jul 2006 06:37:05 -0000 1.3.2.2 @@ -0,0 +1,39 @@ +/* + * JBoss, Home of Professional Open Source + * Copyright 2005, JBoss Inc., and individual contributors as indicated + * by the @authors tag. See the copyright.txt in the distribution for a + * full listing of individual contributors. + * + * This is free software; you can redistribute it and/or modify it + * under the terms of the GNU Lesser General Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * This software is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this software; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA + * 02110-1301 USA, or see the FSF site: http://www.fsf.org. + */ +package org.jboss.security; + +//$Id: SecurityConstants.java,v 1.3.2.2 2006/07/10 06:37:05 j2ee_junkie Exp $ + +/** + * Defines Constants for usage in the Security Layer + * @author <a href="mailto:Ani...@jb...">Anil Saldhana</a> + * @since Dec 30, 2005 + * @version $Revision: 1.3.2.2 $ + */ +public interface SecurityConstants +{ + /** + * The String option name used to pass in the security-domain + * name the LoginModule was configured in. + */ + String SECURITY_DOMAIN_OPTION = "jboss.security.security_domain"; +} |