Class AuthConfig

java.lang.Object
iu.auth.config.AuthConfig

public class AuthConfig extends Object
Authentication and authorization root configuration utility.
  • Method Details

    • register

      public static void register(IuAuthConfig config)
      Registers a configuration descriptor for an authentication realm.

      Only one verifier may be registered per realm

      Parameters:
      config - principal identity verifier
    • registerAdapter

      public static <T> void registerAdapter(Class<T> type, IuJsonAdapter<T> adapter)
      Registers a JSON type adapter for a non-interface configuration class, for example a custom enum.
      Type Parameters:
      T - type
      Parameters:
      type - class
      adapter - IuJsonAdapter
    • registerInterface

      public static <T> void registerInterface(Class<T> configInterface)
      Registers an authorization configuration interface that doesn't tie to a vault configuration name.
      Type Parameters:
      T - configuration type
      Parameters:
      configInterface - configuration interface
    • registerInterface

      public static <T> void registerInterface(String prefix, Class<T> configInterface, IuVault... vault)
      Registers a vault for loading authorization configuration.
      Type Parameters:
      T - configuration type
      Parameters:
      prefix - prefix to append to vault key to classify the resource names used by load(Class, String)
      configInterface - configuration interface
      vault - vault to use for loading configuration
    • registerInterface

      public static <T> void registerInterface(String prefix, Class<T> configInterface, Consumer<? super T> verifier, IuVault... vault)
      Registers a vault for loading authorization configuration.
      Type Parameters:
      T - configuration type
      Parameters:
      prefix - prefix to append to vault key to classify the resource names used by load(Class, String)
      configInterface - configuration interface
      verifier - provides additional verification logic to be apply before returning each loaded instance
      vault - vault to use for loading configuration
    • load

      public static <T> T load(Class<T> configInterface, String key)
      Loads a configuration object from vault.
      Type Parameters:
      T - configuration type
      Parameters:
      configInterface - configuration interface
      key - vault key
      Returns:
      loaded configuration
    • get

      public static <T extends IuAuthConfig> T get(String realm)
      Gets the configuration registered for a realm.
      Type Parameters:
      T - configuration type
      Parameters:
      realm - authentication realm
      Returns:
      IuAuthConfig by realm
    • get

      public static <T extends IuAuthConfig> Iterable<T> get(Class<T> type)
      Finds configuration registered by interface.
      Type Parameters:
      T - configuration type
      Parameters:
      type - type
      Returns:
      IuAuthConfig by type
    • seal

      public static void seal()
      Seals the authentication and authorization configuration.

      Until sealed, no per-realm configurations can be used. Once sealed, no new configurations can be registered. Configuration state is controlled by the auth module.

    • adaptJson

      public static <T> IuJsonAdapter<T> adaptJson(Class<T> type)
      Provides additional JSON adapters for configuring the authorization module.
      Type Parameters:
      T - target type
      Parameters:
      type - type
      Returns:
      IuJsonAdapter
    • adaptJson

      public static IuJsonAdapter<?> adaptJson(Type type)
      Provides JSON adapters for components that used registerInterface(String, Class, Consumer, IuVault...) to register configuration interfaces for authentication and authorization.
      Parameters:
      type - type
      Returns:
      IuJsonAdapter