User: oleg    
  Date: 00/10/17 06:56:42

  Modified:    src/main/org/jboss/security ClientLoginModule.java
                        JaasSecurityManagerService.java
  Log:
  Minor fixed to JAAS stuff
  
  Revision  Changes    Path
  1.2       +12 -18    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.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ClientLoginModule.java    2000/10/16 18:00:17     1.1
  +++ ClientLoginModule.java    2000/10/17 13:56:42     1.2
  @@ -22,19 +22,13 @@
   
   
   public class ClientLoginModule implements LoginModule {
  -    private Subject _subject;
       private CallbackHandler _callbackHandler;
   
  -    // username and password
  -    private String _username;
  -    private char[] _password;
  -
       /**
        * Initialize this LoginModule.
        */
       public void initialize(Subject subject, CallbackHandler callbackHandler,
               Map sharedState, Map options) {
  -        _subject = subject;
           _callbackHandler = callbackHandler;
       }
   
  @@ -52,14 +46,20 @@
           callbacks[0] = new NameCallback("User name: ", "guest");
           callbacks[1] = new PasswordCallback("Password: ", false);
           try {
  +            String username;
  +            char[] password = null;
  +            char[] tmpPassword;
  +
               _callbackHandler.handle(callbacks);
  -            _username = ((NameCallback)callbacks[0]).getName();
  -            char[] tmpPassword = ((PasswordCallback)callbacks[1]).getPassword();
  +            username = ((NameCallback)callbacks[0]).getName();
  +            SecurityAssociation.setPrincipal(new SimplePrincipal(username));
  +            tmpPassword = ((PasswordCallback)callbacks[1]).getPassword();
               if (tmpPassword != null) {
  -                _password = new char[tmpPassword.length];
  -                System.arraycopy(tmpPassword, 0, _password, 0, tmpPassword.length);
  +                password = new char[tmpPassword.length];
  +                System.arraycopy(tmpPassword, 0, password, 0, tmpPassword.length);
                   ((PasswordCallback)callbacks[1]).clearPassword();
               }
  +            SecurityAssociation.setCredential(password);
           } catch (java.io.IOException ioe) {
               throw new LoginException(ioe.toString());
           } catch (UnsupportedCallbackException uce) {
  @@ -74,8 +74,6 @@
        * Method to commit the authentication process (phase 2).
        */
       public boolean commit() throws LoginException {
  -        SecurityAssociation.setPrincipal(new SimplePrincipal(_username));
  -        SecurityAssociation.setCredential(_password);
           return true;
       }    
             
  @@ -83,12 +81,8 @@
        * Method to abort the authentication process (phase 2).
        */
       public boolean abort() throws LoginException {
  -        _username = null;
  -        if (_password != null) {
  -            for (int i = 0; i < _password.length; i++)
  -            _password[i] = ' ';
  -            _password = null;
  -        }
  +        SecurityAssociation.setPrincipal(null);
  +        SecurityAssociation.setCredential(null);
           return true;
       }
   
  
  
  
  1.2       +1 -1      
jboss/src/main/org/jboss/security/JaasSecurityManagerService.java
  
  Index: JaasSecurityManagerService.java
  ===================================================================
  RCS file: 
/products/cvs/ejboss/jboss/src/main/org/jboss/security/JaasSecurityManagerService.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- JaasSecurityManagerService.java   2000/10/16 18:00:18     1.1
  +++ JaasSecurityManagerService.java   2000/10/17 13:56:42     1.2
  @@ -93,7 +93,7 @@
                       smContext.unbind((String) it.next());
                       it.remove();
                   }
  -                ic.destroySubcontext(JNDI_SM_CONTEXT_NAME);
  +                //ic.destroySubcontext(JNDI_SM_CONTEXT_NAME); - 
OperationNotSupportedException
                   smContext = null;
               }
               ic.unbind(JNDI_NAME);
  
  
  

Reply via email to