8173024: Replace direct use of AuthResources resource bundle from jdk.security.auth
Reviewed-by: weijun
This commit is contained in:
parent
ea6b99d730
commit
32ee8faef4
@ -310,7 +310,6 @@ module java.base {
|
||||
// JDK-internal service types
|
||||
uses jdk.internal.logger.DefaultLoggerFinder;
|
||||
uses sun.security.ssl.ClientKeyExchangeService;
|
||||
uses sun.security.util.AuthResourcesProvider;
|
||||
uses sun.text.spi.JavaTimeDateTimePatternProvider;
|
||||
uses sun.util.spi.CalendarProvider;
|
||||
uses sun.util.locale.provider.LocaleDataMetaInfo;
|
||||
@ -322,6 +321,4 @@ module java.base {
|
||||
|
||||
provides java.nio.file.spi.FileSystemProvider with
|
||||
jdk.internal.jrtfs.JrtFileSystemProvider;
|
||||
provides sun.security.util.AuthResourcesProvider with
|
||||
sun.security.util.AuthResourcesProviderImpl;
|
||||
}
|
||||
|
@ -331,9 +331,8 @@ public final class ConfigFile extends Configuration {
|
||||
if (debugConfig != null) {
|
||||
debugConfig.println(fnfe.toString());
|
||||
}
|
||||
throw new IOException(ResourcesMgr.getString
|
||||
("Configuration.Error.No.such.file.or.directory",
|
||||
"sun.security.util.AuthResources"));
|
||||
throw new IOException(ResourcesMgr.getAuthResourceString
|
||||
("Configuration.Error.No.such.file.or.directory"));
|
||||
}
|
||||
}
|
||||
|
||||
@ -661,8 +660,8 @@ public final class ConfigFile extends Configuration {
|
||||
}
|
||||
|
||||
private IOException ioException(String resourceKey, Object... args) {
|
||||
MessageFormat form = new MessageFormat(ResourcesMgr.getString
|
||||
(resourceKey, "sun.security.util.AuthResources"));
|
||||
MessageFormat form = new MessageFormat(
|
||||
ResourcesMgr.getAuthResourceString(resourceKey));
|
||||
return new IOException(form.format(args));
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,7 @@ import java.lang.reflect.Constructor;
|
||||
|
||||
import javax.security.auth.Subject;
|
||||
import sun.security.provider.PolicyParser.PrincipalEntry;
|
||||
import sun.security.util.ResourcesMgr;
|
||||
|
||||
/**
|
||||
* <p> This <code>SubjectCodeSource</code> class contains
|
||||
@ -47,15 +48,6 @@ class SubjectCodeSource extends CodeSource implements java.io.Serializable {
|
||||
|
||||
private static final long serialVersionUID = 6039418085604715275L;
|
||||
|
||||
private static final java.util.ResourceBundle rb =
|
||||
java.security.AccessController.doPrivileged
|
||||
(new java.security.PrivilegedAction<java.util.ResourceBundle>() {
|
||||
public java.util.ResourceBundle run() {
|
||||
return (java.util.ResourceBundle.getBundle
|
||||
("sun.security.util.AuthResources"));
|
||||
}
|
||||
});
|
||||
|
||||
private Subject subject;
|
||||
private LinkedList<PrincipalEntry> principals;
|
||||
private static final Class<?>[] PARAMS = { String.class };
|
||||
@ -391,7 +383,7 @@ class SubjectCodeSource extends CodeSource implements java.io.Serializable {
|
||||
ListIterator<PrincipalEntry> li = principals.listIterator();
|
||||
while (li.hasNext()) {
|
||||
PrincipalEntry pppe = li.next();
|
||||
returnMe = returnMe + rb.getString("NEWLINE") +
|
||||
returnMe = returnMe + ResourcesMgr.getAuthResourceString("NEWLINE") +
|
||||
pppe.getPrincipalClass() + " " +
|
||||
pppe.getPrincipalName();
|
||||
}
|
||||
|
@ -1,29 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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.util;
|
||||
|
||||
public interface AuthResourcesProvider extends java.util.spi.ResourceBundleProvider {
|
||||
}
|
@ -1,35 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 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.util;
|
||||
|
||||
import java.util.spi.AbstractResourceBundleProvider;
|
||||
|
||||
public final class AuthResourcesProviderImpl extends AbstractResourceBundleProvider
|
||||
implements AuthResourcesProvider {
|
||||
public AuthResourcesProviderImpl() {
|
||||
super("java.class");
|
||||
}
|
||||
}
|
@ -25,18 +25,22 @@
|
||||
|
||||
package sun.security.util;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import jdk.internal.misc.VM;
|
||||
|
||||
/**
|
||||
*/
|
||||
public class ResourcesMgr {
|
||||
|
||||
// intended for java.security, javax.security and sun.security resources
|
||||
private static java.util.ResourceBundle bundle;
|
||||
private final static String RESOURCES = "sun.security.util.Resources";
|
||||
private final static String AUTH_RESOURCES = "sun.security.util.AuthResources";
|
||||
|
||||
// intended for com.sun.security resources
|
||||
private static java.util.ResourceBundle altBundle;
|
||||
private final static Map<String, ResourceBundle> bundles = new ConcurrentHashMap<>();
|
||||
|
||||
public static String getString(String s) {
|
||||
|
||||
ResourceBundle bundle = bundles.get(RESOURCES);
|
||||
if (bundle == null) {
|
||||
|
||||
// only load if/when needed
|
||||
@ -52,19 +56,15 @@ public class ResourcesMgr {
|
||||
return bundle.getString(s);
|
||||
}
|
||||
|
||||
public static String getString(String s, final String altBundleName) {
|
||||
|
||||
if (altBundle == null) {
|
||||
|
||||
// only load if/when needed
|
||||
altBundle = java.security.AccessController.doPrivileged(
|
||||
new java.security.PrivilegedAction<java.util.ResourceBundle>() {
|
||||
public java.util.ResourceBundle run() {
|
||||
return (java.util.ResourceBundle.getBundle(altBundleName));
|
||||
}
|
||||
});
|
||||
public static String getAuthResourceString(String s) {
|
||||
if (VM.initLevel() == 3) {
|
||||
// cannot trigger loading of any resource bundle as
|
||||
// it depends on the system class loader fully initialized.
|
||||
throw new InternalError("system class loader is being initialized");
|
||||
}
|
||||
|
||||
return altBundle.getString(s);
|
||||
return bundles.computeIfAbsent(AUTH_RESOURCES, ResourceBundle::getBundle)
|
||||
.getString(s);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -65,9 +65,8 @@ public class NTDomainPrincipal implements Principal, java.io.Serializable {
|
||||
public NTDomainPrincipal(String name) {
|
||||
if (name == null) {
|
||||
java.text.MessageFormat form = new java.text.MessageFormat
|
||||
(sun.security.util.ResourcesMgr.getString
|
||||
("invalid.null.input.value",
|
||||
"sun.security.util.AuthResources"));
|
||||
(sun.security.util.ResourcesMgr.getAuthResourceString
|
||||
("invalid.null.input.value"));
|
||||
Object[] source = {"name"};
|
||||
throw new NullPointerException(form.format(source));
|
||||
}
|
||||
@ -92,9 +91,8 @@ public class NTDomainPrincipal implements Principal, java.io.Serializable {
|
||||
*/
|
||||
public String toString() {
|
||||
java.text.MessageFormat form = new java.text.MessageFormat
|
||||
(sun.security.util.ResourcesMgr.getString
|
||||
("NTDomainPrincipal.name",
|
||||
"sun.security.util.AuthResources"));
|
||||
(sun.security.util.ResourcesMgr.getAuthResourceString
|
||||
("NTDomainPrincipal.name"));
|
||||
Object[] source = {name};
|
||||
return form.format(source);
|
||||
}
|
||||
|
@ -61,9 +61,8 @@ public class NTNumericCredential {
|
||||
*/
|
||||
public String toString() {
|
||||
java.text.MessageFormat form = new java.text.MessageFormat
|
||||
(sun.security.util.ResourcesMgr.getString
|
||||
("NTNumericCredential.name",
|
||||
"sun.security.util.AuthResources"));
|
||||
(sun.security.util.ResourcesMgr.getAuthResourceString
|
||||
("NTNumericCredential.name"));
|
||||
Object[] source = {Long.toString(impersonationToken)};
|
||||
return form.format(source);
|
||||
}
|
||||
|
@ -70,17 +70,15 @@ public class NTSid implements Principal, java.io.Serializable {
|
||||
public NTSid (String stringSid) {
|
||||
if (stringSid == null) {
|
||||
java.text.MessageFormat form = new java.text.MessageFormat
|
||||
(sun.security.util.ResourcesMgr.getString
|
||||
("invalid.null.input.value",
|
||||
"sun.security.util.AuthResources"));
|
||||
(sun.security.util.ResourcesMgr.getAuthResourceString
|
||||
("invalid.null.input.value"));
|
||||
Object[] source = {"stringSid"};
|
||||
throw new NullPointerException(form.format(source));
|
||||
}
|
||||
if (stringSid.length() == 0) {
|
||||
throw new IllegalArgumentException
|
||||
(sun.security.util.ResourcesMgr.getString
|
||||
("Invalid.NTSid.value",
|
||||
"sun.security.util.AuthResources"));
|
||||
(sun.security.util.ResourcesMgr.getAuthResourceString
|
||||
("Invalid.NTSid.value"));
|
||||
}
|
||||
sid = new String(stringSid);
|
||||
}
|
||||
@ -101,9 +99,8 @@ public class NTSid implements Principal, java.io.Serializable {
|
||||
*/
|
||||
public String toString() {
|
||||
java.text.MessageFormat form = new java.text.MessageFormat
|
||||
(sun.security.util.ResourcesMgr.getString
|
||||
("NTSid.name",
|
||||
"sun.security.util.AuthResources"));
|
||||
(sun.security.util.ResourcesMgr.getAuthResourceString
|
||||
("NTSid.name"));
|
||||
Object[] source = {sid};
|
||||
return form.format(source);
|
||||
}
|
||||
|
@ -68,9 +68,8 @@ public class NTSidDomainPrincipal extends NTSid {
|
||||
*/
|
||||
public String toString() {
|
||||
java.text.MessageFormat form = new java.text.MessageFormat
|
||||
(sun.security.util.ResourcesMgr.getString
|
||||
("NTSidDomainPrincipal.name",
|
||||
"sun.security.util.AuthResources"));
|
||||
(sun.security.util.ResourcesMgr.getAuthResourceString
|
||||
("NTSidDomainPrincipal.name"));
|
||||
Object[] source = {getName()};
|
||||
return form.format(source);
|
||||
}
|
||||
|
@ -63,9 +63,8 @@ public class NTSidGroupPrincipal extends NTSid {
|
||||
*/
|
||||
public String toString() {
|
||||
java.text.MessageFormat form = new java.text.MessageFormat
|
||||
(sun.security.util.ResourcesMgr.getString
|
||||
("NTSidGroupPrincipal.name",
|
||||
"sun.security.util.AuthResources"));
|
||||
(sun.security.util.ResourcesMgr.getAuthResourceString
|
||||
("NTSidGroupPrincipal.name"));
|
||||
Object[] source = {getName()};
|
||||
return form.format(source);
|
||||
}
|
||||
|
@ -65,9 +65,8 @@ public class NTSidPrimaryGroupPrincipal extends NTSid {
|
||||
*/
|
||||
public String toString() {
|
||||
java.text.MessageFormat form = new java.text.MessageFormat
|
||||
(sun.security.util.ResourcesMgr.getString
|
||||
("NTSidPrimaryGroupPrincipal.name",
|
||||
"sun.security.util.AuthResources"));
|
||||
(sun.security.util.ResourcesMgr.getAuthResourceString
|
||||
("NTSidPrimaryGroupPrincipal.name"));
|
||||
Object[] source = {getName()};
|
||||
return form.format(source);
|
||||
}
|
||||
|
@ -62,9 +62,8 @@ public class NTSidUserPrincipal extends NTSid {
|
||||
*/
|
||||
public String toString() {
|
||||
java.text.MessageFormat form = new java.text.MessageFormat
|
||||
(sun.security.util.ResourcesMgr.getString
|
||||
("NTSidUserPrincipal.name",
|
||||
"sun.security.util.AuthResources"));
|
||||
(sun.security.util.ResourcesMgr.getAuthResourceString
|
||||
("NTSidUserPrincipal.name"));
|
||||
Object[] source = {getName()};
|
||||
return form.format(source);
|
||||
}
|
||||
|
@ -61,9 +61,8 @@ public class NTUserPrincipal implements Principal, java.io.Serializable {
|
||||
public NTUserPrincipal(String name) {
|
||||
if (name == null) {
|
||||
java.text.MessageFormat form = new java.text.MessageFormat
|
||||
(sun.security.util.ResourcesMgr.getString
|
||||
("invalid.null.input.value",
|
||||
"sun.security.util.AuthResources"));
|
||||
(sun.security.util.ResourcesMgr.getAuthResourceString
|
||||
("invalid.null.input.value"));
|
||||
Object[] source = {"name"};
|
||||
throw new NullPointerException(form.format(source));
|
||||
}
|
||||
@ -86,9 +85,8 @@ public class NTUserPrincipal implements Principal, java.io.Serializable {
|
||||
*/
|
||||
public String toString() {
|
||||
java.text.MessageFormat form = new java.text.MessageFormat
|
||||
(sun.security.util.ResourcesMgr.getString
|
||||
("NTUserPrincipal.name",
|
||||
"sun.security.util.AuthResources"));
|
||||
(sun.security.util.ResourcesMgr.getAuthResourceString
|
||||
("NTUserPrincipal.name"));
|
||||
Object[] source = {name};
|
||||
return form.format(source);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@
|
||||
package com.sun.security.auth;
|
||||
|
||||
import java.security.Principal;
|
||||
import static sun.security.util.ResourcesMgr.getAuthResourceString;
|
||||
|
||||
/**
|
||||
* This class implements the {@code Principal} interface
|
||||
@ -53,9 +54,6 @@ public class SolarisNumericGroupPrincipal implements
|
||||
|
||||
private static final long serialVersionUID = 2345199581042573224L;
|
||||
|
||||
private static final java.util.ResourceBundle rb =
|
||||
java.util.ResourceBundle.getBundle("sun.security.util.AuthResources");
|
||||
|
||||
/**
|
||||
* @serial
|
||||
*/
|
||||
@ -82,7 +80,7 @@ public class SolarisNumericGroupPrincipal implements
|
||||
*/
|
||||
public SolarisNumericGroupPrincipal(String name, boolean primaryGroup) {
|
||||
if (name == null)
|
||||
throw new NullPointerException(rb.getString("provided.null.name"));
|
||||
throw new NullPointerException(getAuthResourceString("provided.null.name"));
|
||||
|
||||
this.name = name;
|
||||
this.primaryGroup = primaryGroup;
|
||||
@ -146,11 +144,11 @@ public class SolarisNumericGroupPrincipal implements
|
||||
* {@code SolarisNumericGroupPrincipal}.
|
||||
*/
|
||||
public String toString() {
|
||||
return((primaryGroup ?
|
||||
rb.getString
|
||||
return primaryGroup ?
|
||||
getAuthResourceString
|
||||
("SolarisNumericGroupPrincipal.Primary.Group.") + name :
|
||||
rb.getString
|
||||
("SolarisNumericGroupPrincipal.Supplementary.Group.") + name));
|
||||
getAuthResourceString
|
||||
("SolarisNumericGroupPrincipal.Supplementary.Group.") + name;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -26,6 +26,7 @@
|
||||
package com.sun.security.auth;
|
||||
|
||||
import java.security.Principal;
|
||||
import static sun.security.util.ResourcesMgr.getAuthResourceString;
|
||||
|
||||
/**
|
||||
* This class implements the {@code Principal} interface
|
||||
@ -52,9 +53,6 @@ public class SolarisNumericUserPrincipal implements
|
||||
|
||||
private static final long serialVersionUID = -3178578484679887104L;
|
||||
|
||||
private static final java.util.ResourceBundle rb =
|
||||
java.util.ResourceBundle.getBundle("sun.security.util.AuthResources");
|
||||
|
||||
/**
|
||||
* @serial
|
||||
*/
|
||||
@ -72,7 +70,7 @@ public class SolarisNumericUserPrincipal implements
|
||||
*/
|
||||
public SolarisNumericUserPrincipal(String name) {
|
||||
if (name == null)
|
||||
throw new NullPointerException(rb.getString("provided.null.name"));
|
||||
throw new NullPointerException(getAuthResourceString("provided.null.name"));
|
||||
|
||||
this.name = name;
|
||||
}
|
||||
@ -118,7 +116,7 @@ public class SolarisNumericUserPrincipal implements
|
||||
* {@code SolarisNumericUserPrincipal}.
|
||||
*/
|
||||
public String toString() {
|
||||
return(rb.getString("SolarisNumericUserPrincipal.") + name);
|
||||
return(getAuthResourceString("SolarisNumericUserPrincipal.") + name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -26,6 +26,8 @@
|
||||
package com.sun.security.auth;
|
||||
|
||||
import java.security.Principal;
|
||||
import static sun.security.util.ResourcesMgr.getAuthResourceString;
|
||||
|
||||
|
||||
/**
|
||||
* This class implements the {@code Principal} interface
|
||||
@ -50,10 +52,6 @@ public class SolarisPrincipal implements Principal, java.io.Serializable {
|
||||
|
||||
private static final long serialVersionUID = -7840670002439379038L;
|
||||
|
||||
private static final java.util.ResourceBundle rb =
|
||||
java.util.ResourceBundle.getBundle("sun.security.util.AuthResources");
|
||||
|
||||
|
||||
/**
|
||||
* @serial
|
||||
*/
|
||||
@ -69,7 +67,7 @@ public class SolarisPrincipal implements Principal, java.io.Serializable {
|
||||
*/
|
||||
public SolarisPrincipal(String name) {
|
||||
if (name == null)
|
||||
throw new NullPointerException(rb.getString("provided.null.name"));
|
||||
throw new NullPointerException(getAuthResourceString("provided.null.name"));
|
||||
|
||||
this.name = name;
|
||||
}
|
||||
@ -89,7 +87,7 @@ public class SolarisPrincipal implements Principal, java.io.Serializable {
|
||||
* @return a string representation of this {@code SolarisPrincipal}.
|
||||
*/
|
||||
public String toString() {
|
||||
return(rb.getString("SolarisPrincipal.") + name);
|
||||
return(getAuthResourceString("SolarisPrincipal.") + name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -74,9 +74,8 @@ public class UnixNumericGroupPrincipal implements
|
||||
public UnixNumericGroupPrincipal(String name, boolean primaryGroup) {
|
||||
if (name == null) {
|
||||
java.text.MessageFormat form = new java.text.MessageFormat
|
||||
(sun.security.util.ResourcesMgr.getString
|
||||
("invalid.null.input.value",
|
||||
"sun.security.util.AuthResources"));
|
||||
(sun.security.util.ResourcesMgr.getAuthResourceString
|
||||
("invalid.null.input.value"));
|
||||
Object[] source = {"name"};
|
||||
throw new NullPointerException(form.format(source));
|
||||
}
|
||||
@ -146,16 +145,14 @@ public class UnixNumericGroupPrincipal implements
|
||||
|
||||
if (primaryGroup) {
|
||||
java.text.MessageFormat form = new java.text.MessageFormat
|
||||
(sun.security.util.ResourcesMgr.getString
|
||||
("UnixNumericGroupPrincipal.Primary.Group.name",
|
||||
"sun.security.util.AuthResources"));
|
||||
(sun.security.util.ResourcesMgr.getAuthResourceString
|
||||
("UnixNumericGroupPrincipal.Primary.Group.name"));
|
||||
Object[] source = {name};
|
||||
return form.format(source);
|
||||
} else {
|
||||
java.text.MessageFormat form = new java.text.MessageFormat
|
||||
(sun.security.util.ResourcesMgr.getString
|
||||
("UnixNumericGroupPrincipal.Supplementary.Group.name",
|
||||
"sun.security.util.AuthResources"));
|
||||
(sun.security.util.ResourcesMgr.getAuthResourceString
|
||||
("UnixNumericGroupPrincipal.Supplementary.Group.name"));
|
||||
Object[] source = {name};
|
||||
return form.format(source);
|
||||
}
|
||||
|
@ -64,9 +64,8 @@ public class UnixNumericUserPrincipal implements
|
||||
public UnixNumericUserPrincipal(String name) {
|
||||
if (name == null) {
|
||||
java.text.MessageFormat form = new java.text.MessageFormat
|
||||
(sun.security.util.ResourcesMgr.getString
|
||||
("invalid.null.input.value",
|
||||
"sun.security.util.AuthResources"));
|
||||
(sun.security.util.ResourcesMgr.getAuthResourceString
|
||||
("invalid.null.input.value"));
|
||||
Object[] source = {"name"};
|
||||
throw new NullPointerException(form.format(source));
|
||||
}
|
||||
@ -116,9 +115,8 @@ public class UnixNumericUserPrincipal implements
|
||||
*/
|
||||
public String toString() {
|
||||
java.text.MessageFormat form = new java.text.MessageFormat
|
||||
(sun.security.util.ResourcesMgr.getString
|
||||
("UnixNumericUserPrincipal.name",
|
||||
"sun.security.util.AuthResources"));
|
||||
(sun.security.util.ResourcesMgr.getAuthResourceString
|
||||
("UnixNumericUserPrincipal.name"));
|
||||
Object[] source = {name};
|
||||
return form.format(source);
|
||||
}
|
||||
|
@ -61,9 +61,8 @@ public class UnixPrincipal implements Principal, java.io.Serializable {
|
||||
public UnixPrincipal(String name) {
|
||||
if (name == null) {
|
||||
java.text.MessageFormat form = new java.text.MessageFormat
|
||||
(sun.security.util.ResourcesMgr.getString
|
||||
("invalid.null.input.value",
|
||||
"sun.security.util.AuthResources"));
|
||||
(sun.security.util.ResourcesMgr.getAuthResourceString
|
||||
("invalid.null.input.value"));
|
||||
Object[] source = {"name"};
|
||||
throw new NullPointerException(form.format(source));
|
||||
}
|
||||
@ -87,9 +86,8 @@ public class UnixPrincipal implements Principal, java.io.Serializable {
|
||||
*/
|
||||
public String toString() {
|
||||
java.text.MessageFormat form = new java.text.MessageFormat
|
||||
(sun.security.util.ResourcesMgr.getString
|
||||
("UnixPrincipal.name",
|
||||
"sun.security.util.AuthResources"));
|
||||
(sun.security.util.ResourcesMgr.getAuthResourceString
|
||||
("UnixPrincipal.name"));
|
||||
Object[] source = {name};
|
||||
return form.format(source);
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ package com.sun.security.auth;
|
||||
|
||||
import java.security.Principal;
|
||||
import sun.security.x509.X500Name;
|
||||
import static sun.security.util.ResourcesMgr.getAuthResourceString;
|
||||
|
||||
/**
|
||||
* This class represents an X.500 {@code Principal}.
|
||||
@ -55,9 +56,6 @@ public class X500Principal implements Principal, java.io.Serializable {
|
||||
|
||||
private static final long serialVersionUID = -8222422609431628648L;
|
||||
|
||||
private static final java.util.ResourceBundle rb =
|
||||
java.util.ResourceBundle.getBundle("sun.security.util.AuthResources");
|
||||
|
||||
/**
|
||||
* @serial
|
||||
*/
|
||||
@ -80,7 +78,7 @@ public class X500Principal implements Principal, java.io.Serializable {
|
||||
*/
|
||||
public X500Principal(String name) {
|
||||
if (name == null)
|
||||
throw new NullPointerException(rb.getString("provided.null.name"));
|
||||
throw new NullPointerException(getAuthResourceString("provided.null.name"));
|
||||
|
||||
try {
|
||||
thisX500Name = new X500Name(name);
|
||||
|
@ -32,15 +32,13 @@ import javax.security.auth.spi.*;
|
||||
import javax.naming.*;
|
||||
import javax.naming.directory.*;
|
||||
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.Map;
|
||||
import java.util.LinkedList;
|
||||
import java.util.ResourceBundle;
|
||||
|
||||
import com.sun.security.auth.UnixPrincipal;
|
||||
import com.sun.security.auth.UnixNumericUserPrincipal;
|
||||
import com.sun.security.auth.UnixNumericGroupPrincipal;
|
||||
import static sun.security.util.ResourcesMgr.getAuthResourceString;
|
||||
|
||||
|
||||
/**
|
||||
@ -153,9 +151,6 @@ import com.sun.security.auth.UnixNumericGroupPrincipal;
|
||||
*/
|
||||
public class JndiLoginModule implements LoginModule {
|
||||
|
||||
private static final ResourceBundle rb =
|
||||
ResourceBundle.getBundle("sun.security.util.AuthResources");
|
||||
|
||||
/** JNDI Provider */
|
||||
public final String USER_PROVIDER = "user.provider.url";
|
||||
public final String GROUP_PROVIDER = "group.provider.url";
|
||||
@ -677,9 +672,9 @@ public class JndiLoginModule implements LoginModule {
|
||||
|
||||
Callback[] callbacks = new Callback[2];
|
||||
callbacks[0] = new NameCallback(protocol + " "
|
||||
+ rb.getString("username."));
|
||||
+ getAuthResourceString("username."));
|
||||
callbacks[1] = new PasswordCallback(protocol + " " +
|
||||
rb.getString("password."),
|
||||
getAuthResourceString("password."),
|
||||
false);
|
||||
|
||||
try {
|
||||
|
@ -51,6 +51,7 @@ import javax.security.auth.login.LoginException;
|
||||
import javax.security.auth.spi.LoginModule;
|
||||
|
||||
import sun.security.util.Password;
|
||||
import static sun.security.util.ResourcesMgr.getAuthResourceString;
|
||||
|
||||
/**
|
||||
* Provides a JAAS login module that prompts for a key store alias and
|
||||
@ -112,9 +113,6 @@ import sun.security.util.Password;
|
||||
*/
|
||||
public class KeyStoreLoginModule implements LoginModule {
|
||||
|
||||
private static final ResourceBundle rb =
|
||||
ResourceBundle.getBundle("sun.security.util.AuthResources");
|
||||
|
||||
/* -- Fields -- */
|
||||
|
||||
private static final int UNINITIALIZED = 0;
|
||||
@ -132,7 +130,7 @@ public class KeyStoreLoginModule implements LoginModule {
|
||||
private static final TextOutputCallback bannerCallback =
|
||||
new TextOutputCallback
|
||||
(TextOutputCallback.INFORMATION,
|
||||
rb.getString("Please.enter.keystore.information"));
|
||||
getAuthResourceString("Please.enter.keystore.information"));
|
||||
private final ConfirmationCallback confirmationCallback =
|
||||
new ConfirmationCallback
|
||||
(ConfirmationCallback.INFORMATION,
|
||||
@ -344,11 +342,10 @@ public class KeyStoreLoginModule implements LoginModule {
|
||||
|
||||
NameCallback aliasCallback;
|
||||
if (keyStoreAlias == null || keyStoreAlias.length() == 0) {
|
||||
aliasCallback = new NameCallback(
|
||||
rb.getString("Keystore.alias."));
|
||||
aliasCallback = new NameCallback(getAuthResourceString("Keystore.alias."));
|
||||
} else {
|
||||
aliasCallback =
|
||||
new NameCallback(rb.getString("Keystore.alias."),
|
||||
new NameCallback(getAuthResourceString("Keystore.alias."),
|
||||
keyStoreAlias);
|
||||
}
|
||||
|
||||
@ -360,11 +357,11 @@ public class KeyStoreLoginModule implements LoginModule {
|
||||
break;
|
||||
case NORMAL:
|
||||
keyPassCallback = new PasswordCallback
|
||||
(rb.getString("Private.key.password.optional."), false);
|
||||
(getAuthResourceString("Private.key.password.optional."), false);
|
||||
// fall thru
|
||||
case TOKEN:
|
||||
storePassCallback = new PasswordCallback
|
||||
(rb.getString("Keystore.password."), false);
|
||||
(getAuthResourceString("Keystore.password."), false);
|
||||
break;
|
||||
}
|
||||
prompt(aliasCallback, storePassCallback, keyPassCallback);
|
||||
|
@ -27,8 +27,6 @@
|
||||
package com.sun.security.auth.module;
|
||||
|
||||
import java.io.*;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.text.MessageFormat;
|
||||
import java.util.*;
|
||||
|
||||
@ -45,6 +43,7 @@ import sun.security.krb5.*;
|
||||
import sun.security.jgss.krb5.Krb5Util;
|
||||
import sun.security.krb5.Credentials;
|
||||
import sun.security.util.HexDumpEncoder;
|
||||
import static sun.security.util.ResourcesMgr.getAuthResourceString;
|
||||
|
||||
/**
|
||||
* This {@code LoginModule} authenticates users using
|
||||
@ -419,8 +418,6 @@ public class Krb5LoginModule implements LoginModule {
|
||||
|
||||
private static final String NAME = "javax.security.auth.login.name";
|
||||
private static final String PWD = "javax.security.auth.login.password";
|
||||
private static final ResourceBundle rb =
|
||||
ResourceBundle.getBundle("sun.security.util.AuthResources");
|
||||
|
||||
/**
|
||||
* Initialize this {@code LoginModule}.
|
||||
@ -831,7 +828,7 @@ public class Krb5LoginModule implements LoginModule {
|
||||
|
||||
Callback[] callbacks = new Callback[1];
|
||||
MessageFormat form = new MessageFormat(
|
||||
rb.getString(
|
||||
getAuthResourceString(
|
||||
"Kerberos.username.defUsername."));
|
||||
Object[] source = {defUsername};
|
||||
callbacks[0] = new NameCallback(form.format(source));
|
||||
@ -886,7 +883,7 @@ public class Krb5LoginModule implements LoginModule {
|
||||
Callback[] callbacks = new Callback[1];
|
||||
String userName = krb5PrincName.toString();
|
||||
MessageFormat form = new MessageFormat(
|
||||
rb.getString(
|
||||
getAuthResourceString(
|
||||
"Kerberos.password.for.username."));
|
||||
Object[] source = {userName};
|
||||
callbacks[0] = new PasswordCallback(
|
||||
|
@ -25,14 +25,11 @@
|
||||
|
||||
package com.sun.security.auth.module;
|
||||
|
||||
import java.security.AccessController;
|
||||
import java.net.SocketPermission;
|
||||
import java.security.Principal;
|
||||
import java.security.PrivilegedAction;
|
||||
import java.util.Arrays;
|
||||
import java.util.Hashtable;
|
||||
import java.util.Map;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
import java.util.Set;
|
||||
@ -47,6 +44,7 @@ import javax.security.auth.spi.*;
|
||||
|
||||
import com.sun.security.auth.LdapPrincipal;
|
||||
import com.sun.security.auth.UserPrincipal;
|
||||
import static sun.security.util.ResourcesMgr.getAuthResourceString;
|
||||
|
||||
|
||||
/**
|
||||
@ -305,10 +303,6 @@ import com.sun.security.auth.UserPrincipal;
|
||||
*/
|
||||
public class LdapLoginModule implements LoginModule {
|
||||
|
||||
// Use the default classloader for this class to load the prompt strings.
|
||||
private static final ResourceBundle rb =
|
||||
ResourceBundle.getBundle("sun.security.util.AuthResources");
|
||||
|
||||
// Keys to retrieve the stored username and password
|
||||
private static final String USERNAME_KEY = "javax.security.auth.login.name";
|
||||
private static final String PASSWORD_KEY =
|
||||
@ -957,8 +951,8 @@ public class LdapLoginModule implements LoginModule {
|
||||
"to acquire authentication information from the user");
|
||||
|
||||
Callback[] callbacks = new Callback[2];
|
||||
callbacks[0] = new NameCallback(rb.getString("username."));
|
||||
callbacks[1] = new PasswordCallback(rb.getString("password."), false);
|
||||
callbacks[0] = new NameCallback(getAuthResourceString("username."));
|
||||
callbacks[1] = new PasswordCallback(getAuthResourceString("password."), false);
|
||||
|
||||
try {
|
||||
callbackHandler.handle(callbacks);
|
||||
|
@ -36,8 +36,6 @@ module jdk.security.auth {
|
||||
exports com.sun.security.auth.login;
|
||||
exports com.sun.security.auth.module;
|
||||
|
||||
uses sun.security.util.AuthResourcesProvider;
|
||||
|
||||
provides javax.security.auth.spi.LoginModule with
|
||||
com.sun.security.auth.module.Krb5LoginModule,
|
||||
com.sun.security.auth.module.UnixLoginModule,
|
||||
|
Loading…
x
Reference in New Issue
Block a user