michael-o commented on code in PR #399:
URL: 
https://github.com/apache/httpcomponents-client/pull/399#discussion_r1046272608


##########
httpclient5/src/main/java/org/apache/hc/client5/http/auth/UsernamePasswordCredentials.java:
##########
@@ -45,22 +45,36 @@ public class UsernamePasswordCredentials implements 
Credentials, Serializable {
 
     private static final long serialVersionUID = 243343858802739403L;
 
-    private final BasicUserPrincipal principal;
+    private final Principal principal;
     private final char[] password;
 
     /**
      * The constructor with the username and password arguments.
      *
-     * @param userName the user name
+     * @param principal the user principal
      * @param password the password
+     *
+     * @since 5.3
+     *
+     * @see BasicUserPrincipal
+     * @see NTUserPrincipal
      */
-    public UsernamePasswordCredentials(final String userName, final char[] 
password) {
+    public UsernamePasswordCredentials(final Principal principal, final char[] 
password) {
         super();
-        Args.notNull(userName, "Username");
-        this.principal = new BasicUserPrincipal(userName);
+        this.principal = Args.notNull(principal, "User principal");
         this.password = password;
     }
 
+    /**
+     * The constructor with the username and password arguments.
+     *
+     * @param username the user name
+     * @param password the password
+     */
+    public UsernamePasswordCredentials(final String username, final char[] 
password) {
+        this(new BasicUserPrincipal(username), password);

Review Comment:
   Shouldn't username be tested for `null` as well?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@hc.apache.org
For additional commands, e-mail: dev-h...@hc.apache.org

Reply via email to