java.lang.Object
com.linecorp.centraldogma.server.metadata.Tokens

public final class Tokens extends Object
Holds a token map and a secret map for fast lookup.
  • Constructor Details

    • Tokens

      public Tokens()
      Creates a new empty instance.
    • Tokens

      public Tokens(Map<String,Token> appIds, Map<String,String> secrets)
      Creates a new instance with the given application IDs and secrets.
  • Method Details

    • appIds

      public Map<String,Token> appIds()
      Returns the application Tokens.
    • secrets

      public Map<String,String> secrets()
      Returns the secrets.
    • get

      public Token get(String appId)
      Returns the Token that corresponds to the specified application ID.
    • getOrDefault

      @Nullable public Token getOrDefault(String appId, @Nullable Token defaultValue)
      Returns the Token that corresponds to the specified application ID. defaultValue is returned if there's no such application.
    • findBySecret

      public Token findBySecret(String secret)
      Returns the Token that corresponds to the specified secret.
    • findBySecretOrDefault

      @Nullable public Token findBySecretOrDefault(String secret, @Nullable Token defaultValue)
      Returns the Token that corresponds to the specified secret. defaultValue is returned if there's no such secret.
    • withoutSecret

      public Tokens withoutSecret()
      Returns a new Tokens which does not contain any secrets.
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • isValidSecret

      public static boolean isValidSecret(@Nullable String secret)
      Returns true if the specified secret is valid.
    • validateSecret

      public static void validateSecret(String secret)
      Throws an IllegalArgumentException if the specified secret is not valid.