Class AppIdentityRegistry

java.lang.Object
com.linecorp.centraldogma.server.metadata.AppIdentityRegistry
All Implemented Interfaces:
HasWeight

public final class AppIdentityRegistry extends Object implements HasWeight
Holds an app identity map, a secret map and a certificate ID map for fast lookup.
  • Constructor Details

    • AppIdentityRegistry

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

      public AppIdentityRegistry(Map<String, AppIdentity> appIds, Map<String,String> secrets, @Nullable Map<String,String> certificateIds)
      Creates a new instance with the given appIDs, secrets, and certificateIds.
  • Method Details

    • appIds

      public Map<String, AppIdentity> appIds()
      Returns the app identities.
    • secrets

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

      public Map<String,String> certificateIds()
      Returns the certificate IDs.
    • get

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

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

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

      public @Nullable 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.
    • findByCertificateId

      public CertificateAppIdentity findByCertificateId(String certificateId)
      Returns the CertificateAppIdentity that corresponds to the specified certificate ID.
    • findByCertificateIdOrDefault

      public @Nullable CertificateAppIdentity findByCertificateIdOrDefault(String certificateId, @Nullable CertificateAppIdentity defaultValue)
      Returns the CertificateAppIdentity that corresponds to the specified certificate ID. defaultValue is returned if there's no such certificate ID.
    • withoutSecret

      public AppIdentityRegistry withoutSecret()
      Returns a new AppIdentityRegistry which does not contain any secrets.
    • weight

      public int weight()
      Description copied from interface: HasWeight
      Returns the weight of this object.
      Specified by:
      weight in interface HasWeight
    • 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.