Module bus.http

Class Challenge

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

public class Challenge extends Object
An RFC 7235 compliant authentication challenge.
Since:
Java 17+
Author:
Kimi Liu
  • Constructor Details

    • Challenge

      public Challenge(String scheme, Map<String,String> authParams)
      Constructs a new Challenge with a scheme and a map of parameters.
      Parameters:
      scheme - The authentication scheme.
      authParams - The map of authentication parameters.
    • Challenge

      public Challenge(String scheme, String realm)
      Constructs a new Challenge with a scheme and a realm.
      Parameters:
      scheme - The authentication scheme.
      realm - The authentication realm.
  • Method Details

    • withCharset

      public Challenge withCharset(Charset charset)
      Returns a copy of this challenge with the charset auth param set.
      Parameters:
      charset - The character set to be used for encoding credentials.
      Returns:
      A new Challenge instance with the specified charset.
    • scheme

      public String scheme()
      Returns the authentication scheme, like Basic.
      Returns:
      The scheme string.
    • authParams

      public Map<String,String> authParams()
      Returns the auth params, including realm and charset if present, but as strings. The map's keys are lowercase and should be treated case-insensitively.
      Returns:
      An unmodifiable map of authentication parameters.
    • realm

      public String realm()
      Returns the protection space.
      Returns:
      The realm string.
    • charset

      public Charset charset()
      Returns the charset that should be used to encode the credentials. Defaults to ISO-8859-1.
      Returns:
      The character set.
    • equals

      public boolean equals(Object other)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object