diff --git a/jdk/src/share/classes/java/security/Provider.java b/jdk/src/share/classes/java/security/Provider.java index e8c7a081b5a..05f670c29bd 100644 --- a/jdk/src/share/classes/java/security/Provider.java +++ b/jdk/src/share/classes/java/security/Provider.java @@ -1332,7 +1332,7 @@ public abstract class Provider extends Properties { addEngine("SSLContext", false, null); addEngine("TrustManagerFactory", false, null); // JGSS - addEngine("GssApiMechanism", false, null); + addEngine("GssApiMechanism", true, "sun.security.jgss.GSSCaller"); // SASL addEngine("SaslClientFactory", false, null); addEngine("SaslServerFactory", false, null); diff --git a/jdk/src/share/classes/sun/security/jgss/krb5/Krb5MechFactory.java b/jdk/src/share/classes/sun/security/jgss/krb5/Krb5MechFactory.java index ffae2cdc2fa..cc9626c14f7 100644 --- a/jdk/src/share/classes/sun/security/jgss/krb5/Krb5MechFactory.java +++ b/jdk/src/share/classes/sun/security/jgss/krb5/Krb5MechFactory.java @@ -86,6 +86,10 @@ public final class Krb5MechFactory implements MechanismFactory { return result; } + public Krb5MechFactory() { + this(GSSCaller.CALLER_UNKNOWN); + } + public Krb5MechFactory(GSSCaller caller) { this.caller = caller; } diff --git a/jdk/src/share/classes/sun/security/jgss/spnego/SpNegoMechFactory.java b/jdk/src/share/classes/sun/security/jgss/spnego/SpNegoMechFactory.java index cb60230d4f9..511547b8a78 100644 --- a/jdk/src/share/classes/sun/security/jgss/spnego/SpNegoMechFactory.java +++ b/jdk/src/share/classes/sun/security/jgss/spnego/SpNegoMechFactory.java @@ -96,6 +96,10 @@ public final class SpNegoMechFactory implements MechanismFactory { return result; } + public SpNegoMechFactory() { + this(GSSCaller.CALLER_UNKNOWN); + } + public SpNegoMechFactory(GSSCaller caller) { manager = new GSSManagerImpl(caller, false); Oid[] mechs = manager.getMechs(); diff --git a/jdk/test/javax/security/auth/kerberos/KerberosHashEqualsTest.java b/jdk/test/javax/security/auth/kerberos/KerberosHashEqualsTest.java index 906700c71cc..9578a59547a 100644 --- a/jdk/test/javax/security/auth/kerberos/KerberosHashEqualsTest.java +++ b/jdk/test/javax/security/auth/kerberos/KerberosHashEqualsTest.java @@ -25,7 +25,6 @@ * @test * @bug 4641821 * @summary hashCode() and equals() for KerberosKey and KerberosTicket - * @run main/manual KerberosHashEqualsTest */ /* @@ -60,8 +59,8 @@ public class KerberosHashEqualsTest { void check() throws Exception { KerberosKey k1, k2; - k1 = new KerberosKey(new KerberosPrincipal("A"), "pass".getBytes(), 1, 1); - k2 = new KerberosKey(new KerberosPrincipal("A"), "pass".getBytes(), 1, 1); + k1 = new KerberosKey(newKP("A"), "pass".getBytes(), 1, 1); + k2 = new KerberosKey(newKP("A"), "pass".getBytes(), 1, 1); checkSame(k1, k1); // me to me checkSame(k1, k2); // same @@ -73,13 +72,13 @@ public class KerberosHashEqualsTest { checkSame(k2, k2); // a little different - k2 = new KerberosKey(new KerberosPrincipal("B"), "pass".getBytes(), 1, 1); + k2 = new KerberosKey(newKP("B"), "pass".getBytes(), 1, 1); checkNotSame(k1, k2); - k2 = new KerberosKey(new KerberosPrincipal("A"), "ssap".getBytes(), 1, 1); + k2 = new KerberosKey(newKP("A"), "ssap".getBytes(), 1, 1); checkNotSame(k1, k2); - k2 = new KerberosKey(new KerberosPrincipal("A"), "pass".getBytes(), 2, 1); + k2 = new KerberosKey(newKP("A"), "pass".getBytes(), 2, 1); checkNotSame(k1, k2); - k2 = new KerberosKey(new KerberosPrincipal("A"), "pass".getBytes(), 1, 2); + k2 = new KerberosKey(newKP("A"), "pass".getBytes(), 1, 2); checkNotSame(k1, k2); k1 = new KerberosKey(null, "pass".getBytes(), 1, 2); @@ -90,33 +89,33 @@ public class KerberosHashEqualsTest { checkNotSame(k1, "Another Object"); KerberosTicket t1, t2; - t1 = new KerberosTicket("asn1".getBytes(), new KerberosPrincipal("client"), new KerberosPrincipal("server"), "pass".getBytes(), 1, new boolean[] {true, true}, new Date(0), new Date(0), new Date(0), new Date(0), null); - t2 = new KerberosTicket("asn1".getBytes(), new KerberosPrincipal("client"), new KerberosPrincipal("server"), "pass".getBytes(), 1, new boolean[] {true, true}, new Date(0), new Date(0), new Date(0), new Date(0), null); + t1 = new KerberosTicket("asn1".getBytes(), newKP("client"), newKP("server"), "pass".getBytes(), 1, new boolean[] {true, true}, new Date(0), new Date(0), new Date(0), new Date(0), null); + t2 = new KerberosTicket("asn1".getBytes(), newKP("client"), newKP("server"), "pass".getBytes(), 1, new boolean[] {true, true}, new Date(0), new Date(0), new Date(0), new Date(0), null); checkSame(t1, t1); checkSame(t1, t2); - t2 = new KerberosTicket("asn11".getBytes(), new KerberosPrincipal("client"), new KerberosPrincipal("server"), "pass".getBytes(), 1, new boolean[] {true, true}, new Date(0), new Date(0), new Date(0), new Date(0), null); + t2 = new KerberosTicket("asn11".getBytes(), newKP("client"), newKP("server"), "pass".getBytes(), 1, new boolean[] {true, true}, new Date(0), new Date(0), new Date(0), new Date(0), null); checkNotSame(t1, t2); - t2 = new KerberosTicket("asn1".getBytes(), new KerberosPrincipal("client1"), new KerberosPrincipal("server"), "pass".getBytes(), 1, new boolean[] {true, true}, new Date(0), new Date(0), new Date(0), new Date(0), null); + t2 = new KerberosTicket("asn1".getBytes(), newKP("client1"), newKP("server"), "pass".getBytes(), 1, new boolean[] {true, true}, new Date(0), new Date(0), new Date(0), new Date(0), null); checkNotSame(t1, t2); - t2 = new KerberosTicket("asn1".getBytes(), new KerberosPrincipal("client"), new KerberosPrincipal("server1"), "pass".getBytes(), 1, new boolean[] {true, true}, new Date(0), new Date(0), new Date(0), new Date(0), null); + t2 = new KerberosTicket("asn1".getBytes(), newKP("client"), newKP("server1"), "pass".getBytes(), 1, new boolean[] {true, true}, new Date(0), new Date(0), new Date(0), new Date(0), null); checkNotSame(t1, t2); - t2 = new KerberosTicket("asn1".getBytes(), new KerberosPrincipal("client"), new KerberosPrincipal("server"), "pass1".getBytes(), 1, new boolean[] {true, true}, new Date(0), new Date(0), new Date(0), new Date(0), null); + t2 = new KerberosTicket("asn1".getBytes(), newKP("client"), newKP("server"), "pass1".getBytes(), 1, new boolean[] {true, true}, new Date(0), new Date(0), new Date(0), new Date(0), null); checkNotSame(t1, t2); - t2 = new KerberosTicket("asn1".getBytes(), new KerberosPrincipal("client"), new KerberosPrincipal("server"), "pass".getBytes(), 2, new boolean[] {true, true}, new Date(0), new Date(0), new Date(0), new Date(0), null); + t2 = new KerberosTicket("asn1".getBytes(), newKP("client"), newKP("server"), "pass".getBytes(), 2, new boolean[] {true, true}, new Date(0), new Date(0), new Date(0), new Date(0), null); checkNotSame(t1, t2); - t2 = new KerberosTicket("asn1".getBytes(), new KerberosPrincipal("client"), new KerberosPrincipal("server"), "pass".getBytes(), 1, new boolean[] {false, true}, new Date(0), new Date(0), new Date(0), new Date(0), null); + t2 = new KerberosTicket("asn1".getBytes(), newKP("client"), newKP("server"), "pass".getBytes(), 1, new boolean[] {false, true}, new Date(0), new Date(0), new Date(0), new Date(0), null); checkNotSame(t1, t2); - t2 = new KerberosTicket("asn1".getBytes(), new KerberosPrincipal("client"), new KerberosPrincipal("server"), "pass".getBytes(), 1, new boolean[] {true, true}, new Date(1), new Date(0), new Date(0), new Date(0), null); + t2 = new KerberosTicket("asn1".getBytes(), newKP("client"), newKP("server"), "pass".getBytes(), 1, new boolean[] {true, true}, new Date(1), new Date(0), new Date(0), new Date(0), null); checkNotSame(t1, t2); - t2 = new KerberosTicket("asn1".getBytes(), new KerberosPrincipal("client"), new KerberosPrincipal("server"), "pass".getBytes(), 1, new boolean[] {true, true}, new Date(0), new Date(1), new Date(0), new Date(0), null); + t2 = new KerberosTicket("asn1".getBytes(), newKP("client"), newKP("server"), "pass".getBytes(), 1, new boolean[] {true, true}, new Date(0), new Date(1), new Date(0), new Date(0), null); checkNotSame(t1, t2); - t2 = new KerberosTicket("asn1".getBytes(), new KerberosPrincipal("client"), new KerberosPrincipal("server"), "pass".getBytes(), 1, new boolean[] {true, true}, new Date(0), new Date(0), new Date(1), new Date(0), null); + t2 = new KerberosTicket("asn1".getBytes(), newKP("client"), newKP("server"), "pass".getBytes(), 1, new boolean[] {true, true}, new Date(0), new Date(0), new Date(1), new Date(0), null); checkNotSame(t1, t2); - t2 = new KerberosTicket("asn1".getBytes(), new KerberosPrincipal("client"), new KerberosPrincipal("server"), "pass".getBytes(), 1, new boolean[] {true, true}, new Date(0), new Date(0), new Date(0), new Date(0), new InetAddress[2]); + t2 = new KerberosTicket("asn1".getBytes(), newKP("client"), newKP("server"), "pass".getBytes(), 1, new boolean[] {true, true}, new Date(0), new Date(0), new Date(0), new Date(0), new InetAddress[2]); checkNotSame(t1, t2); - t2 = new KerberosTicket("asn1".getBytes(), new KerberosPrincipal("client"), new KerberosPrincipal("server"), "pass".getBytes(), 1, new boolean[] {true, true}, new Date(0), new Date(0), new Date(0), new Date(1), null); - t1 = new KerberosTicket("asn1".getBytes(), new KerberosPrincipal("client"), new KerberosPrincipal("server"), "pass".getBytes(), 1, new boolean[] {true, true}, new Date(0), new Date(0), new Date(0), new Date(2), null); + t2 = new KerberosTicket("asn1".getBytes(), newKP("client"), newKP("server"), "pass".getBytes(), 1, new boolean[] {true, true}, new Date(0), new Date(0), new Date(0), new Date(1), null); + t1 = new KerberosTicket("asn1".getBytes(), newKP("client"), newKP("server"), "pass".getBytes(), 1, new boolean[] {true, true}, new Date(0), new Date(0), new Date(0), new Date(2), null); checkSame(t1, t2); // renewtill is useless t2.destroy(); @@ -126,11 +125,15 @@ public class KerberosHashEqualsTest { checkNotSame(t2, t1); checkSame(t2, t2); - t2 = new KerberosTicket("asn1".getBytes(), new KerberosPrincipal("client"), new KerberosPrincipal("server"), "pass".getBytes(), 1, new boolean[] {true, true, true, true, true, true, true, true, true, true}, new Date(0), new Date(0), new Date(0), new Date(1), null); - t1 = new KerberosTicket("asn1".getBytes(), new KerberosPrincipal("client"), new KerberosPrincipal("server"), "pass".getBytes(), 1, new boolean[] {true, true, true, true, true, true, true, true, true, true}, new Date(0), new Date(0), new Date(0), new Date(2), null); + t2 = new KerberosTicket("asn1".getBytes(), newKP("client"), newKP("server"), "pass".getBytes(), 1, new boolean[] {true, true, true, true, true, true, true, true, true, true}, new Date(0), new Date(0), new Date(0), new Date(1), null); + t1 = new KerberosTicket("asn1".getBytes(), newKP("client"), newKP("server"), "pass".getBytes(), 1, new boolean[] {true, true, true, true, true, true, true, true, true, true}, new Date(0), new Date(0), new Date(0), new Date(2), null); checkNotSame(t1, t2); // renewtill is useful checkNotSame(t1, "Another Object"); System.out.println("Good!"); } + + KerberosPrincipal newKP(String s) { + return new KerberosPrincipal(s + "@JLABS.SFBAY.SUN.COM"); + } } diff --git a/jdk/test/javax/security/auth/kerberos/KerberosTixDateTest.java b/jdk/test/javax/security/auth/kerberos/KerberosTixDateTest.java index 2fed8d083cb..53b5ec8068a 100644 --- a/jdk/test/javax/security/auth/kerberos/KerberosTixDateTest.java +++ b/jdk/test/javax/security/auth/kerberos/KerberosTixDateTest.java @@ -25,7 +25,6 @@ * @test * @bug 6659990 * @summary test the immutability of the Date fields in KerberosTicket class. - * @run main/manual KerberosTixDateTest */ /* @@ -64,8 +63,8 @@ public class KerberosTixDateTest { public static void main(String[] args) throws Exception { byte[] asn1Bytes = "asn1".getBytes(); - KerberosPrincipal client = new KerberosPrincipal("client"); - KerberosPrincipal server = new KerberosPrincipal("server"); + KerberosPrincipal client = new KerberosPrincipal("client@JLABS.SFBAY.SUN.COM"); + KerberosPrincipal server = new KerberosPrincipal("server@JLABS.SFBAY.SUN.COM"); byte[] keyBytes = "sessionKey".getBytes(); long originalTime = 12345678L; Date inDate = new Date(originalTime);