Class Credentials

java.lang.Object
org.acemq.amqp.security.Credentials

public final class Credentials extends Object
A username and a secret.

The secret never appears in toString(), and there is no getter that reads like one. Credentials reach logs, health endpoints, exception messages and crash dumps by way of some object's toString, and that is how they end up in a log aggregator that half the company can search.

  • Method Details

    • of

      public static Credentials of(String username, String password)
      Parameters:
      username - the user to connect as
      password - its password
      Returns:
      the pair
    • token

      public static Credentials token(String token)
      A bearer token, as RabbitMQ's OAuth 2 support expects it.
      Parameters:
      token - the token, which the broker reads as the password
      Returns:
      credentials carrying it
    • username

      public String username()
      Returns:
      the user to connect as
    • secret

      public char[] secret()
      Returns:
      a copy of the secret. A copy, so that a caller clearing its array cannot blank this one, and so that this one's array never escapes
    • toString

      public String toString()
      Overrides:
      toString in class Object