Module bus.http

Class Credentials

java.lang.Object
org.miaixz.bus.http.secure.Credentials

public final class Credentials extends Object
A factory for creating HTTP authorization credentials.
Since:
Java 17+
Author:
Kimi Liu
  • Method Details

    • basic

      public static String basic(String username, String password)
      Returns a credential string for Basic HTTP authentication using the ISO-8859-1 charset.
      Parameters:
      username - The username.
      password - The password.
      Returns:
      The formatted credential string (e.g., "Basic dXNlcjpwYXNz").
    • basic

      public static String basic(String username, String password, Charset charset)
      Returns a credential string for Basic HTTP authentication using the specified charset.
      Parameters:
      username - The username.
      password - The password.
      charset - The character set to use for encoding the credentials.
      Returns:
      The formatted credential string (e.g., "Basic dXNlcjpwYXNz").