changeset 4346:b8bcb12acea6

7048466: Move sun.misc.JavaxSecurityAuthKerberosAccess to sun.security.krb5 package Reviewed-by: weijun, alanb Contributed-by: Mandy Chung <mandy.chung@oracle.com>
author weijun
date Fri, 27 May 2011 09:01:33 +0800
parents 3f760b347d3b
children 0da0a4d22fba
files src/share/classes/javax/security/auth/kerberos/JavaxSecurityAuthKerberosAccessImpl.java src/share/classes/javax/security/auth/kerberos/KeyTab.java src/share/classes/sun/misc/JavaxSecurityAuthKerberosAccess.java src/share/classes/sun/misc/SharedSecrets.java src/share/classes/sun/security/jgss/krb5/Krb5Util.java src/share/classes/sun/security/krb5/JavaxSecurityAuthKerberosAccess.java src/share/classes/sun/security/krb5/KerberosSecrets.java
diffstat 7 files changed, 95 insertions(+), 63 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/classes/javax/security/auth/kerberos/JavaxSecurityAuthKerberosAccessImpl.java	Tue May 24 15:28:26 2011 -0700
+++ b/src/share/classes/javax/security/auth/kerberos/JavaxSecurityAuthKerberosAccessImpl.java	Fri May 27 09:01:33 2011 +0800
@@ -25,7 +25,7 @@
 
 package javax.security.auth.kerberos;
 
-import sun.misc.JavaxSecurityAuthKerberosAccess;
+import sun.security.krb5.JavaxSecurityAuthKerberosAccess;
 import sun.security.krb5.EncryptionKey;
 import sun.security.krb5.PrincipalName;
 
--- a/src/share/classes/javax/security/auth/kerberos/KeyTab.java	Tue May 24 15:28:26 2011 -0700
+++ b/src/share/classes/javax/security/auth/kerberos/KeyTab.java	Fri May 27 09:01:33 2011 +0800
@@ -27,8 +27,8 @@
 
 import java.io.File;
 import java.util.Objects;
-import sun.misc.SharedSecrets;
 import sun.security.krb5.EncryptionKey;
+import sun.security.krb5.KerberosSecrets;
 import sun.security.krb5.PrincipalName;
 import sun.security.krb5.RealmException;
 
@@ -74,9 +74,9 @@
     // is maintained in snapshot, this field is never "resolved".
     private final File file;
 
-    // Set up JavaxSecurityAuthKerberosAccess in SharedSecrets
+    // Set up JavaxSecurityAuthKerberosAccess in KerberosSecrets
     static {
-        SharedSecrets.setJavaxSecurityAuthKerberosAccess(
+        KerberosSecrets.setJavaxSecurityAuthKerberosAccess(
                 new JavaxSecurityAuthKerberosAccessImpl());
     }
 
--- a/src/share/classes/sun/misc/JavaxSecurityAuthKerberosAccess.java	Tue May 24 15:28:26 2011 -0700
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,43 +0,0 @@
-/*
- * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.  Oracle designates this
- * particular file as subject to the "Classpath" exception as provided
- * by Oracle in the LICENSE file that accompanied this code.
- *
- * This code is distributed in the hope that it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
- * version 2 for more details (a copy is included in the LICENSE file that
- * accompanied this code).
- *
- * You should have received a copy of the GNU General Public License version
- * 2 along with this work; if not, write to the Free Software Foundation,
- * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- *
- * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
- * or visit www.oracle.com if you need additional information or have any
- * questions.
- */
-
-package sun.misc;
-
-import javax.security.auth.kerberos.KeyTab;
-import sun.security.krb5.EncryptionKey;
-import sun.security.krb5.PrincipalName;
-
-/**
- * An unsafe tunnel to get non-public access to classes in the
- * javax.security.auth.kerberos package.
- */
-public interface JavaxSecurityAuthKerberosAccess {
-    /**
-     * Returns keys for a principal in a keytab.
-     * @return the keys, never null, can be empty.
-     */
-    public EncryptionKey[] keyTabGetEncryptionKeys(
-            KeyTab ktab, PrincipalName principal);
-}
--- a/src/share/classes/sun/misc/SharedSecrets.java	Tue May 24 15:28:26 2011 -0700
+++ b/src/share/classes/sun/misc/SharedSecrets.java	Fri May 27 09:01:33 2011 +0800
@@ -29,7 +29,6 @@
 import java.io.Console;
 import java.io.FileDescriptor;
 import java.security.ProtectionDomain;
-import javax.security.auth.kerberos.KeyTab;
 
 import java.security.AccessController;
 
@@ -52,7 +51,6 @@
     private static JavaIOFileDescriptorAccess javaIOFileDescriptorAccess;
     private static JavaSecurityProtectionDomainAccess javaSecurityProtectionDomainAccess;
     private static JavaSecurityAccess javaSecurityAccess;
-    private static JavaxSecurityAuthKerberosAccess javaxSecurityAuthKerberosAccess;
 
     public static JavaUtilJarAccess javaUtilJarAccess() {
         if (javaUtilJarAccess == null) {
@@ -141,16 +139,4 @@
         }
         return javaSecurityAccess;
     }
-
-    public static void setJavaxSecurityAuthKerberosAccess
-            (JavaxSecurityAuthKerberosAccess jsaka) {
-        javaxSecurityAuthKerberosAccess = jsaka;
-    }
-
-    public static JavaxSecurityAuthKerberosAccess
-            getJavaxSecurityAuthKerberosAccess() {
-        if (javaxSecurityAuthKerberosAccess == null)
-            unsafe.ensureClassInitialized(KeyTab.class);
-        return javaxSecurityAuthKerberosAccess;
-    }
 }
--- a/src/share/classes/sun/security/jgss/krb5/Krb5Util.java	Tue May 24 15:28:26 2011 -0700
+++ b/src/share/classes/sun/security/jgss/krb5/Krb5Util.java	Fri May 27 09:01:33 2011 +0800
@@ -44,7 +44,7 @@
 import java.util.List;
 import java.util.Objects;
 import java.util.Set;
-import sun.misc.SharedSecrets;
+import sun.security.krb5.KerberosSecrets;
 import sun.security.krb5.PrincipalName;
 /**
  * Utilities for obtaining and converting Kerberos tickets.
@@ -378,7 +378,7 @@
      */
     public static EncryptionKey[] keysFromJavaxKeyTab(
             KeyTab ktab, PrincipalName cname) {
-        return SharedSecrets.getJavaxSecurityAuthKerberosAccess().
+        return KerberosSecrets.getJavaxSecurityAuthKerberosAccess().
                 keyTabGetEncryptionKeys(ktab, cname);
     }
 
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/sun/security/krb5/JavaxSecurityAuthKerberosAccess.java	Fri May 27 09:01:33 2011 +0800
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.security.krb5;
+
+import javax.security.auth.kerberos.KeyTab;
+import sun.security.krb5.EncryptionKey;
+import sun.security.krb5.PrincipalName;
+
+/**
+ * An unsafe tunnel to get non-public access to classes in the
+ * javax.security.auth.kerberos package.
+ */
+public interface JavaxSecurityAuthKerberosAccess {
+    /**
+     * Returns keys for a principal in a keytab.
+     * @return the keys, never null, can be empty.
+     */
+    public EncryptionKey[] keyTabGetEncryptionKeys(
+            KeyTab ktab, PrincipalName principal);
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/share/classes/sun/security/krb5/KerberosSecrets.java	Fri May 27 09:01:33 2011 +0800
@@ -0,0 +1,46 @@
+/*
+ * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.  Oracle designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Oracle in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+package sun.security.krb5;
+
+import javax.security.auth.kerberos.KeyTab;
+import sun.misc.Unsafe;
+
+public class KerberosSecrets {
+    private static final Unsafe unsafe = Unsafe.getUnsafe();
+    private static JavaxSecurityAuthKerberosAccess javaxSecurityAuthKerberosAccess;
+
+    public static void setJavaxSecurityAuthKerberosAccess
+            (JavaxSecurityAuthKerberosAccess jsaka) {
+        javaxSecurityAuthKerberosAccess = jsaka;
+    }
+
+    public static JavaxSecurityAuthKerberosAccess
+            getJavaxSecurityAuthKerberosAccess() {
+        if (javaxSecurityAuthKerberosAccess == null)
+            unsafe.ensureClassInitialized(KeyTab.class);
+        return javaxSecurityAuthKerberosAccess;
+    }
+}