You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ga...@apache.org on 2009/07/09 22:35:35 UTC

svn commit: r792674 - in /geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src: main/java/org/apache/geronimo/jetty7/ main/java/org/apache/geronimo/jetty7/security/ test/java/org/apache/geronimo/jetty7/security/

Author: gawor
Date: Thu Jul  9 20:35:35 2009
New Revision: 792674

URL: http://svn.apache.org/viewvc?rev=792674&view=rev
Log:
recognize CLIENT-CERT instead of CLIENTCERT

Added:
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/test/java/org/apache/geronimo/jetty7/security/BuiltInAuthMethodTest.java   (with props)
Modified:
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyContainerImpl.java
    geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/BuiltInAuthMethod.java

Modified: geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyContainerImpl.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyContainerImpl.java?rev=792674&r1=792673&r2=792674&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyContainerImpl.java (original)
+++ geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/JettyContainerImpl.java Thu Jul  9 20:35:35 2009
@@ -232,7 +232,7 @@
                               ClassLoader classLoader) throws Exception {
         SecurityHandler securityHandler = null;
         if (configurationFactory != null) {
-            BuiltInAuthMethod builtInAuthMethod = BuiltInAuthMethod.valueOf(authMethod);
+            BuiltInAuthMethod builtInAuthMethod = BuiltInAuthMethod.getValueOf(authMethod);
             JettySecurityHandlerFactory  factory = new JettySecurityHandlerFactory(builtInAuthMethod, null, null, realmName, configurationFactory);
             Permission permission = new WebUserDataPermission("/*", protectedMethods, transportGuarantee);
             boolean authMandatory = builtInAuthMethod != BuiltInAuthMethod.NONE;

Modified: geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/BuiltInAuthMethod.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/BuiltInAuthMethod.java?rev=792674&r1=792673&r2=792674&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/BuiltInAuthMethod.java (original)
+++ geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/main/java/org/apache/geronimo/jetty7/security/BuiltInAuthMethod.java Thu Jul  9 20:35:35 2009
@@ -24,5 +24,26 @@
  * @version $Rev$ $Date$
  */
 public enum BuiltInAuthMethod {
-    NONE, BASIC, DIGEST, FORM, CLIENTCERT
+
+    NONE("NONE"), BASIC("BASIC"), DIGEST("DIGEST"), FORM("FORM"), CLIENTCERT("CLIENT-CERT");
+
+    private String value;
+
+    private BuiltInAuthMethod(String value) {
+        this.value = value;
+    }
+
+    public String toString() {
+        return value;
+    }
+
+    public static BuiltInAuthMethod getValueOf(String name) {
+        for (BuiltInAuthMethod method : BuiltInAuthMethod.values()) {
+            if (method.toString().equals(name)) {
+                return method;
+            }
+        }
+        throw new IllegalArgumentException("No enum for " + name);
+    }
+
 }

Added: geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/test/java/org/apache/geronimo/jetty7/security/BuiltInAuthMethodTest.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/test/java/org/apache/geronimo/jetty7/security/BuiltInAuthMethodTest.java?rev=792674&view=auto
==============================================================================
--- geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/test/java/org/apache/geronimo/jetty7/security/BuiltInAuthMethodTest.java (added)
+++ geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/test/java/org/apache/geronimo/jetty7/security/BuiltInAuthMethodTest.java Thu Jul  9 20:35:35 2009
@@ -0,0 +1,35 @@
+/**
+ *  Licensed to the Apache Software Foundation (ASF) under one or more
+ *  contributor license agreements.  See the NOTICE file distributed with
+ *  this work for additional information regarding copyright ownership.
+ *  The ASF licenses this file to You under the Apache License, Version 2.0
+ *  (the "License"); you may not use this file except in compliance with
+ *  the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *  Unless required by applicable law or agreed to in writing, software
+ *  distributed under the License is distributed on an "AS IS" BASIS,
+ *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ *  See the License for the specific language governing permissions and
+ *  limitations under the License.
+ */
+
+
+package org.apache.geronimo.jetty7.security;
+
+import junit.framework.TestCase;
+
+/**
+ * @version $Rev$ $Date$
+ */
+public class BuiltInAuthMethodTest extends TestCase {
+    
+    public void test() {
+        assertEquals(BuiltInAuthMethod.BASIC, BuiltInAuthMethod.getValueOf("BASIC"));
+        assertEquals(BuiltInAuthMethod.DIGEST, BuiltInAuthMethod.getValueOf("DIGEST"));
+        assertEquals(BuiltInAuthMethod.FORM, BuiltInAuthMethod.getValueOf("FORM"));
+        assertEquals(BuiltInAuthMethod.CLIENTCERT, BuiltInAuthMethod.getValueOf("CLIENT-CERT"));
+    }
+    
+}

Propchange: geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/test/java/org/apache/geronimo/jetty7/security/BuiltInAuthMethodTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/test/java/org/apache/geronimo/jetty7/security/BuiltInAuthMethodTest.java
------------------------------------------------------------------------------
    svn:keywords = Date Revision

Propchange: geronimo/server/trunk/plugins/jetty7/geronimo-jetty7/src/test/java/org/apache/geronimo/jetty7/security/BuiltInAuthMethodTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain