8344147: Remove Security Manager dependencies from java.security.sasl module
Reviewed-by: rriggs, ascarpino
This commit is contained in:
parent
ec148c1365
commit
d959c7ded7
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2003, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -24,8 +24,6 @@
|
|||||||
*/
|
*/
|
||||||
package com.sun.security.sasl;
|
package com.sun.security.sasl;
|
||||||
|
|
||||||
import java.security.AccessController;
|
|
||||||
import java.security.PrivilegedAction;
|
|
||||||
import java.security.NoSuchAlgorithmException;
|
import java.security.NoSuchAlgorithmException;
|
||||||
import java.security.InvalidParameterException;
|
import java.security.InvalidParameterException;
|
||||||
import java.security.ProviderException;
|
import java.security.ProviderException;
|
||||||
@ -98,34 +96,28 @@ public final class Provider extends java.security.Provider {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("removal")
|
|
||||||
public Provider() {
|
public Provider() {
|
||||||
super("SunSASL", PROVIDER_VER, info);
|
super("SunSASL", PROVIDER_VER, info);
|
||||||
|
|
||||||
final Provider p = this;
|
final Provider p = this;
|
||||||
AccessController.doPrivileged(new PrivilegedAction<Void>() {
|
// Client mechanisms
|
||||||
public Void run() {
|
putService(new ProviderService(p, "SaslClientFactory",
|
||||||
// Client mechanisms
|
"DIGEST-MD5", "com.sun.security.sasl.digest.FactoryImpl"));
|
||||||
putService(new ProviderService(p, "SaslClientFactory",
|
putService(new ProviderService(p, "SaslClientFactory",
|
||||||
"DIGEST-MD5", "com.sun.security.sasl.digest.FactoryImpl"));
|
"NTLM", "com.sun.security.sasl.ntlm.FactoryImpl"));
|
||||||
putService(new ProviderService(p, "SaslClientFactory",
|
putService(new ProviderService(p, "SaslClientFactory",
|
||||||
"NTLM", "com.sun.security.sasl.ntlm.FactoryImpl"));
|
"EXTERNAL", "com.sun.security.sasl.ClientFactoryImpl"));
|
||||||
putService(new ProviderService(p, "SaslClientFactory",
|
putService(new ProviderService(p, "SaslClientFactory",
|
||||||
"EXTERNAL", "com.sun.security.sasl.ClientFactoryImpl"));
|
"PLAIN", "com.sun.security.sasl.ClientFactoryImpl"));
|
||||||
putService(new ProviderService(p, "SaslClientFactory",
|
putService(new ProviderService(p, "SaslClientFactory",
|
||||||
"PLAIN", "com.sun.security.sasl.ClientFactoryImpl"));
|
"CRAM-MD5", "com.sun.security.sasl.ClientFactoryImpl"));
|
||||||
putService(new ProviderService(p, "SaslClientFactory",
|
|
||||||
"CRAM-MD5", "com.sun.security.sasl.ClientFactoryImpl"));
|
|
||||||
|
|
||||||
// Server mechanisms
|
// Server mechanisms
|
||||||
putService(new ProviderService(p, "SaslServerFactory",
|
putService(new ProviderService(p, "SaslServerFactory",
|
||||||
"CRAM-MD5", "com.sun.security.sasl.ServerFactoryImpl"));
|
"CRAM-MD5", "com.sun.security.sasl.ServerFactoryImpl"));
|
||||||
putService(new ProviderService(p, "SaslServerFactory",
|
putService(new ProviderService(p, "SaslServerFactory",
|
||||||
"DIGEST-MD5", "com.sun.security.sasl.digest.FactoryImpl"));
|
"DIGEST-MD5", "com.sun.security.sasl.digest.FactoryImpl"));
|
||||||
putService(new ProviderService(p, "SaslServerFactory",
|
putService(new ProviderService(p, "SaslServerFactory",
|
||||||
"NTLM", "com.sun.security.sasl.ntlm.FactoryImpl"));
|
"NTLM", "com.sun.security.sasl.ntlm.FactoryImpl"));
|
||||||
return null;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -26,8 +26,6 @@
|
|||||||
package javax.security.sasl;
|
package javax.security.sasl;
|
||||||
|
|
||||||
import javax.security.auth.callback.CallbackHandler;
|
import javax.security.auth.callback.CallbackHandler;
|
||||||
import java.security.AccessController;
|
|
||||||
import java.security.PrivilegedAction;
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Enumeration;
|
import java.util.Enumeration;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
@ -74,10 +72,7 @@ public class Sasl {
|
|||||||
private static List<String> disabledMechanisms = new ArrayList<>();
|
private static List<String> disabledMechanisms = new ArrayList<>();
|
||||||
|
|
||||||
static {
|
static {
|
||||||
@SuppressWarnings("removal")
|
String prop = Security.getProperty("jdk.sasl.disabledMechanisms");
|
||||||
String prop = AccessController.doPrivileged(
|
|
||||||
(PrivilegedAction<String>)
|
|
||||||
() -> Security.getProperty("jdk.sasl.disabledMechanisms"));
|
|
||||||
|
|
||||||
if (prop != null) {
|
if (prop != null) {
|
||||||
for (String s : prop.split("\\s*,\\s*")) {
|
for (String s : prop.split("\\s*,\\s*")) {
|
||||||
@ -452,9 +447,7 @@ public class Sasl {
|
|||||||
* that was used to load the provider.
|
* that was used to load the provider.
|
||||||
* In order to get the class loader of a class, the
|
* In order to get the class loader of a class, the
|
||||||
* caller's class loader must be the same as or an ancestor of
|
* caller's class loader must be the same as or an ancestor of
|
||||||
* the class loader being returned. Otherwise, the caller must
|
* the class loader being returned.
|
||||||
* have "getClassLoader" permission, or a SecurityException
|
|
||||||
* will be thrown.
|
|
||||||
*/
|
*/
|
||||||
return service.newInstance(null);
|
return service.newInstance(null);
|
||||||
} catch (InvalidParameterException | NoSuchAlgorithmException e) {
|
} catch (InvalidParameterException | NoSuchAlgorithmException e) {
|
||||||
|
Loading…
Reference in New Issue
Block a user