diff --git a/nucleus/admin/util/src/main/java/com/sun/enterprise/admin/util/AuthenticationInfo.java b/nucleus/admin/util/src/main/java/com/sun/enterprise/admin/util/AuthenticationInfo.java index d5bf8d84f82..2efdbb963c0 100755 --- a/nucleus/admin/util/src/main/java/com/sun/enterprise/admin/util/AuthenticationInfo.java +++ b/nucleus/admin/util/src/main/java/com/sun/enterprise/admin/util/AuthenticationInfo.java @@ -37,11 +37,10 @@ * only if the new code is made subject to such option by the copyright * holder. */ +// Portions Copyright [2018] [Payara Foundation and/or its affiliates] package com.sun.enterprise.admin.util; -import com.sun.enterprise.util.StringUtils; - /** * A class that holds the user and password for the connection to the server. * Used by the HttpConnectorAddress class. @@ -50,9 +49,18 @@ public final class AuthenticationInfo { private final String user; private final char[] password; + + /** + * + * @param user the user name for the connection + * @param password the clear text password for the connection + */ + public AuthenticationInfo(String user, String password) { + this(user,password.toCharArray()); + } /** - * The only way to construct the instances of this class. + * * @param user the user name for the connection * @param password the clear text password for the connection */ @@ -73,8 +81,8 @@ public String getUser() { * Returns the password in clear text. * @return String */ - public char[] getPassword() { - return password; + public String getPassword() { + return new String(password); } @Override diff --git a/nucleus/admin/util/src/main/java/com/sun/enterprise/admin/util/HttpConnectorAddress.java b/nucleus/admin/util/src/main/java/com/sun/enterprise/admin/util/HttpConnectorAddress.java index 95169af80b5..2b42315194b 100755 --- a/nucleus/admin/util/src/main/java/com/sun/enterprise/admin/util/HttpConnectorAddress.java +++ b/nucleus/admin/util/src/main/java/com/sun/enterprise/admin/util/HttpConnectorAddress.java @@ -38,7 +38,7 @@ * holder. */ -// Portions Copyright [2016-2017] [Payara Foundation and/or its affiliates] +// Portions Copyright [2016-2018] [Payara Foundation and/or its affiliates] package com.sun.enterprise.admin.util; @@ -305,7 +305,7 @@ private String getUser() { } private char[] getPassword() { - return authInfo != null ? authInfo.getPassword() : "".toCharArray(); + return authInfo != null ? authInfo.getPassword().toCharArray() : "".toCharArray(); } private URLConnection openConnection(URL url) throws IOException {