geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a..@apache.org
Subject cvs commit: incubator-geronimo/modules/core/src/java/org/apache/geronimo/security LoginModuleWrapper.java
Date Wed, 12 Nov 2003 04:30:35 GMT
adc         2003/11/11 20:30:35

  Modified:    modules/core/src/java/org/apache/geronimo/security
                        LoginModuleWrapper.java
  Log:
  Register/UnRegister the Subject's context
  
  Revision  Changes    Path
  1.3       +15 -1     incubator-geronimo/modules/core/src/java/org/apache/geronimo/security/LoginModuleWrapper.java
  
  Index: LoginModuleWrapper.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/core/src/java/org/apache/geronimo/security/LoginModuleWrapper.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- LoginModuleWrapper.java	10 Nov 2003 20:31:54 -0000	1.2
  +++ LoginModuleWrapper.java	12 Nov 2003 04:30:35 -0000	1.3
  @@ -55,6 +55,8 @@
    */
   package org.apache.geronimo.security;
   
  +import org.apache.geronimo.security.util.ContextManager;
  +
   import javax.security.auth.spi.LoginModule;
   import javax.security.auth.Subject;
   import javax.security.auth.login.LoginException;
  @@ -64,6 +66,8 @@
   import java.util.Iterator;
   import java.security.Principal;
   import java.security.PrivilegedActionException;
  +import java.security.AccessControlContext;
  +import java.security.AccessController;
   
   
   /**
  @@ -135,6 +139,14 @@
           externalSubject.getPrivateCredentials().addAll(internalSubject.getPrivateCredentials());
           externalSubject.getPublicCredentials().addAll(internalSubject.getPublicCredentials());
   
  +        AccessControlContext context = (AccessControlContext)Subject.doAsPrivileged(externalSubject,
new java.security.PrivilegedAction() {
  +            public Object run() {
  +                return AccessController.getContext();
  +            }
  +        }, null);
  +        externalSubject.getPrivateCredentials().add(new AccessControlContextCredential(context));
  +        ContextManager.registerContext(externalSubject, context);
  +
           return true;
       }
   
  @@ -143,6 +155,8 @@
       }
   
       public boolean logout() throws LoginException {
  +        ContextManager.unregisterContext(externalSubject);
  +
           return module.logout();
       }
   }
  
  
  

Mime
View raw message