geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gr...@apache.org
Subject svn commit: r419286 - in /geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty: JettySecurityHandler.java JettyWebAppContext.java
Date Wed, 05 Jul 2006 17:22:53 GMT
Author: gregw
Date: Wed Jul  5 10:22:52 2006
New Revision: 419286

URL: http://svn.apache.org/viewvc?rev=419286&view=rev
Log:
minor clean up of some redundant init args

Modified:
    geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettySecurityHandler.java
    geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java

Modified: geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettySecurityHandler.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettySecurityHandler.java?rev=419286&r1=419285&r2=419286&view=diff
==============================================================================
--- geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettySecurityHandler.java
(original)
+++ geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettySecurityHandler.java
Wed Jul  5 10:22:52 2006
@@ -61,7 +61,6 @@
 
     private PermissionCollection excludedPermissions;
 
-    private Authenticator authenticator;
 
     private JAASJettyRealm realm;
 
@@ -69,34 +68,31 @@
     }
 
     public void init(String policyContextID,
-            DefaultPrincipal defaultPrincipal, Authenticator authenticator,
+            DefaultPrincipal defaultPrincipal, 
             PermissionCollection checkedPermissions,
-            PermissionCollection excludedPermissions, Map roleDesignates,
-            JAASJettyRealm realm, ClassLoader classLoader) {
+            PermissionCollection excludedPermissions, 
+            Map roleDesignates,
+            ClassLoader classLoader) {
         assert realm != null;
-        assert authenticator != null;
 
         this.policyContextID = policyContextID;
 
-        this.defaultPrincipal = generateDefaultPrincipal(defaultPrincipal,
-                classLoader);
+        this.defaultPrincipal = generateDefaultPrincipal(defaultPrincipal,classLoader);
         this.roleDesignates = roleDesignates;
         this.checked = checkedPermissions;
         this.excludedPermissions = excludedPermissions;
 
+        Authenticator authenticator = getAuthenticator();
         if (authenticator instanceof FormAuthenticator) {
-            String formLoginPath = ((FormAuthenticator) authenticator)
-                    .getLoginPage();
+            String formLoginPath = ((FormAuthenticator) authenticator).getLoginPage();
             if (formLoginPath.indexOf('?') > 0) {
-                formLoginPath = formLoginPath.substring(0, formLoginPath
-                        .indexOf('?'));
+                formLoginPath = formLoginPath.substring(0, formLoginPath.indexOf('?'));
             }
             this.formLoginPath = formLoginPath;
         } else {
             formLoginPath = null;
         }
 
-        this.authenticator = authenticator;
         /**
          * Register our default principal with the ContextManager
          */
@@ -104,7 +100,7 @@
         ContextManager.registerSubject(defaultSubject);
         SubjectId id = ContextManager.getSubjectId(defaultSubject);
         defaultSubject.getPrincipals().add(new IdentificationPrincipal(id));
-        this.realm = realm;
+        this.realm = (JAASJettyRealm)getUserRealm();
     }
 
     public void doStop(JettyContainer jettyContainer) throws Exception {
@@ -246,6 +242,7 @@
         boolean forbidden = excludedPermissions.implies(resourcePermission)
                 || excludedPermissions.implies(dataPermission);
 
+        Authenticator authenticator = getAuthenticator();
         if (!unauthenticated && !forbidden) {
             return authenticator.authenticate(realm, pathInContext, request,
                     response);

Modified: geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java
URL: http://svn.apache.org/viewvc/geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java?rev=419286&r1=419285&r2=419286&view=diff
==============================================================================
--- geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java
(original)
+++ geronimo/sandbox/servlet-2.5/modules/jetty/src/java/org/apache/geronimo/jetty/JettyWebAppContext.java
Wed Jul  5 10:22:52 2006
@@ -62,6 +62,7 @@
 import org.mortbay.jetty.Request;
 import org.mortbay.jetty.Response;
 import org.mortbay.jetty.security.Authenticator;
+import org.mortbay.jetty.security.SecurityHandler;
 import org.mortbay.jetty.servlet.ServletHandler;
 import org.mortbay.jetty.servlet.ServletHolder;
 import org.mortbay.jetty.servlet.ServletMapping;
@@ -240,8 +241,10 @@
             InternalJAASJettyRealm internalJAASJettyRealm = jettyContainer.addRealm(securityRealmName);
             //wrap jetty realm with something that knows the dumb realmName
             JAASJettyRealm realm = new JAASJettyRealm(realmName, internalJAASJettyRealm);
-            this.webAppContext.getSecurityHandler().setUserRealm(realm);
-            ((JettySecurityHandler)this.webAppContext.getSecurityHandler()).init(policyContextID,
defaultPrincipal, authenticator, checkedPermissions, excludedPermissions, roleDesignates,
realm, classLoader);
+            SecurityHandler security_handler = this.webAppContext.getSecurityHandler();
+            security_handler.setUserRealm(realm);
+            
+            ((JettySecurityHandler)this.webAppContext.getSecurityHandler()).init(policyContextID,
defaultPrincipal, checkedPermissions, excludedPermissions, roleDesignates,  classLoader);
             
         }
 //      end JACC



Mime
View raw message