You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by le...@apache.org on 2007/10/19 10:57:38 UTC
svn commit: r586338 - in /harmony/enhanced/classlib/trunk/modules/auth:
META-INF/ src/main/java/common/org/apache/harmony/auth/jgss/kerberos/
src/main/java/common/org/apache/harmony/auth/jgss/kerberos/toolbox/
src/test/java/common/org/apache/harmony/au...
Author: leoli
Date: Fri Oct 19 01:57:35 2007
New Revision: 586338
URL: http://svn.apache.org/viewvc?rev=586338&view=rev
Log:
Apply patch for HARMONY-4721([classlib][auth]Harmony lacks default JGSS provider)(2) Add KerberosToolboxSpi interface to seperate Kerberos Tools Provider.
Added:
harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/org/apache/harmony/auth/jgss/kerberos/toolbox/
harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/org/apache/harmony/auth/jgss/kerberos/toolbox/KerberosToolboxImpl.java (with props)
harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/org/apache/harmony/auth/jgss/kerberos/toolbox/KerberosToolboxSpi.java (with props)
harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/jgss/kerberos/KerberosUtilsTest.java (with props)
Modified:
harmony/enhanced/classlib/trunk/modules/auth/META-INF/MANIFEST.MF
harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/org/apache/harmony/auth/jgss/kerberos/KerberosUtils.java
Modified: harmony/enhanced/classlib/trunk/modules/auth/META-INF/MANIFEST.MF
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/auth/META-INF/MANIFEST.MF?rev=586338&r1=586337&r2=586338&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/auth/META-INF/MANIFEST.MF (original)
+++ harmony/enhanced/classlib/trunk/modules/auth/META-INF/MANIFEST.MF Fri Oct 19 01:57:35 2007
@@ -17,6 +17,7 @@
java.beans,
java.io,
java.lang,
+ java.lang.reflect,
java.math;resolution:=optional,
java.net,
java.nio.charset,
Modified: harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/org/apache/harmony/auth/jgss/kerberos/KerberosUtils.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/org/apache/harmony/auth/jgss/kerberos/KerberosUtils.java?rev=586338&r1=586337&r2=586338&view=diff
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/org/apache/harmony/auth/jgss/kerberos/KerberosUtils.java (original)
+++ harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/org/apache/harmony/auth/jgss/kerberos/KerberosUtils.java Fri Oct 19 01:57:35 2007
@@ -17,6 +17,9 @@
package org.apache.harmony.auth.jgss.kerberos;
+import java.lang.reflect.Constructor;
+
+import org.apache.harmony.auth.jgss.kerberos.toolbox.KerberosToolboxSpi;
import org.ietf.jgss.GSSException;
import org.ietf.jgss.GSSName;
import org.ietf.jgss.Oid;
@@ -33,6 +36,8 @@
public static final Oid KRB5_PRINCIPAL_NAMETYPE;
public static final Oid[] SUPPORTED_NAME_MECHS;
+
+ public static final String KERBEROS_TOOLBOX_PROVIDER = "org.apache.harmony.auth.jgss.kerberos.toolbox.KerberosToolboxImpl";
static {
try {
@@ -45,6 +50,12 @@
SUPPORTED_NAME_MECHS = new Oid[] { GSSName.NT_USER_NAME,
GSSName.NT_HOSTBASED_SERVICE, GSSName.NT_EXPORT_NAME,
KRB5_PRINCIPAL_NAMETYPE };
- }
+ }
+
+ public static KerberosToolboxSpi getKerberosToolbox(String kdcName) throws Exception{
+ Class cls = Class.forName(KERBEROS_TOOLBOX_PROVIDER);
+ Constructor constructor = cls.getConstructor(String.class);
+ return (KerberosToolboxSpi) constructor.newInstance(kdcName);
+ }
}
Added: harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/org/apache/harmony/auth/jgss/kerberos/toolbox/KerberosToolboxImpl.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/org/apache/harmony/auth/jgss/kerberos/toolbox/KerberosToolboxImpl.java?rev=586338&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/org/apache/harmony/auth/jgss/kerberos/toolbox/KerberosToolboxImpl.java (added)
+++ harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/org/apache/harmony/auth/jgss/kerberos/toolbox/KerberosToolboxImpl.java Fri Oct 19 01:57:35 2007
@@ -0,0 +1,44 @@
+/*
+ * 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.harmony.auth.jgss.kerberos.toolbox;
+
+import javax.security.auth.kerberos.KerberosTicket;
+
+
+/*
+ * The class will wrap the dependency on external kerberos tools.
+ */
+public class KerberosToolboxImpl implements KerberosToolboxSpi {
+
+ private String kdc;
+
+ public KerberosToolboxImpl(String kdc){
+ this.kdc = kdc;
+ }
+
+ public KerberosTicket getTGS(String serverPrincipalName, KerberosTicket TGT) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+ public KerberosTicket getTGT(String clientPrincipalName) {
+ // TODO Auto-generated method stub
+ return null;
+ }
+
+}
Propchange: harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/org/apache/harmony/auth/jgss/kerberos/toolbox/KerberosToolboxImpl.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/org/apache/harmony/auth/jgss/kerberos/toolbox/KerberosToolboxSpi.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/org/apache/harmony/auth/jgss/kerberos/toolbox/KerberosToolboxSpi.java?rev=586338&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/org/apache/harmony/auth/jgss/kerberos/toolbox/KerberosToolboxSpi.java (added)
+++ harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/org/apache/harmony/auth/jgss/kerberos/toolbox/KerberosToolboxSpi.java Fri Oct 19 01:57:35 2007
@@ -0,0 +1,25 @@
+/*
+ * 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.harmony.auth.jgss.kerberos.toolbox;
+
+import javax.security.auth.kerberos.KerberosTicket;
+
+public interface KerberosToolboxSpi {
+ KerberosTicket getTGT(String clientPrincipalName);
+ KerberosTicket getTGS(String serverPrincipalName, KerberosTicket TGT);
+}
Propchange: harmony/enhanced/classlib/trunk/modules/auth/src/main/java/common/org/apache/harmony/auth/jgss/kerberos/toolbox/KerberosToolboxSpi.java
------------------------------------------------------------------------------
svn:eol-style = native
Added: harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/jgss/kerberos/KerberosUtilsTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/jgss/kerberos/KerberosUtilsTest.java?rev=586338&view=auto
==============================================================================
--- harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/jgss/kerberos/KerberosUtilsTest.java (added)
+++ harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/jgss/kerberos/KerberosUtilsTest.java Fri Oct 19 01:57:35 2007
@@ -0,0 +1,33 @@
+/*
+ * 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.harmony.auth.tests.jgss.kerberos;
+
+import org.apache.harmony.auth.jgss.kerberos.KerberosUtils;
+import org.apache.harmony.auth.jgss.kerberos.toolbox.KerberosToolboxImpl;
+import org.apache.harmony.auth.jgss.kerberos.toolbox.KerberosToolboxSpi;
+
+import junit.framework.TestCase;
+
+public class KerberosUtilsTest extends TestCase {
+
+ public void testGetKerberosToolBox() throws Exception {
+ KerberosToolboxSpi kerberosToolBoxSpi = KerberosUtils
+ .getKerberosToolbox("TESTKDCNAME");
+ assertTrue(kerberosToolBoxSpi instanceof KerberosToolboxImpl);
+ }
+}
Propchange: harmony/enhanced/classlib/trunk/modules/auth/src/test/java/common/org/apache/harmony/auth/tests/jgss/kerberos/KerberosUtilsTest.java
------------------------------------------------------------------------------
svn:eol-style = native