Package org.apache.catalina.authenticator

## Class BasicAuthenticator.BasicCredentials

- java.lang.Object
- - org.apache.catalina.authenticator.BasicAuthenticator.BasicCredentials

- Enclosing class:
    BasicAuthenticator

      public static class BasicAuthenticator.BasicCredentials
      extends java.lang.Object

  Parser for an HTTP Authorization header for BASIC authentication as per RFC 2617 section 2, and the Base64 encoded credentials as per RFC 2045 section 6.8.

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `BasicCredentials​(ByteChunk input, java.nio.charset.Charset charset)` | Deprecated. Unused.
    `BasicCredentials​(ByteChunk input, java.nio.charset.Charset charset, boolean trimCredentials)` | Parse the HTTP Authorization header for BASIC authentication as per RFC 2617 section 2, and the Base64 encoded credentials as per RFC 2045 section 6.8.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `java.lang.String` | `getPassword()` | Trivial accessor.
    `java.lang.String` | `getUsername()` | Trivial accessor.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### BasicCredentials

          @Deprecated
          public BasicCredentials​(ByteChunk input,
                                  java.nio.charset.Charset charset)
                           throws java.lang.IllegalArgumentException

      Deprecated.
      Unused. Will be removed in Tomcat 10. Use 3-arg constructor
      Parse the HTTP Authorization header for BASIC authentication as per RFC 2617 section 2, and the Base64 encoded credentials as per RFC 2045 section 6.8.
      Parameters:
        `input` - The header value to parse in-place
        `charset` - The character set to use to convert the bytes to a string
      Throws:
        `java.lang.IllegalArgumentException` - If the header does not conform to RFC 2617

    - #### BasicCredentials

          public BasicCredentials​(ByteChunk input,
                                  java.nio.charset.Charset charset,
                                  boolean trimCredentials)
                           throws java.lang.IllegalArgumentException

      Parse the HTTP Authorization header for BASIC authentication as per RFC 2617 section 2, and the Base64 encoded credentials as per RFC 2045 section 6.8.
      Parameters:
        `input` - The header value to parse in-place
        `charset` - The character set to use to convert the bytes to a string
        `trimCredentials` - Should leading and trailing whitespace be removed from the parsed credentials
      Throws:
        `java.lang.IllegalArgumentException` - If the header does not conform to RFC 2617

  - ### Method Detail

    - #### getUsername

          public java.lang.String getUsername()

      Trivial accessor.
      Returns:
        the decoded username token as a String, which is never be `null`, but can be empty.

    - #### getPassword

          public java.lang.String getPassword()

      Trivial accessor.
      Returns:
        the decoded password token as a String, or `null` if no password was found in the credentials.