Class SimpleAuthConfigProvider

  • All Implemented Interfaces:
    AuthConfigProvider

    public class SimpleAuthConfigProvider
    extends java.lang.Object
    implements AuthConfigProvider
    Basic implementation primarily intended for use when using third-party ServerAuthModule implementations that only provide the module.
    • Constructor Summary

      Constructors 
      Constructor Description
      SimpleAuthConfigProvider​(java.util.Map<java.lang.String,​java.lang.Object> properties, AuthConfigFactory factory)
      Creates a new SimpleAuthConfigProvider.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected ServerAuthConfig createServerAuthConfig​(java.lang.String layer, java.lang.String appContext, javax.security.auth.callback.CallbackHandler handler, java.util.Map<java.lang.String,​java.lang.Object> properties)
      Creates the ServerAuthConfig.
      ClientAuthConfig getClientAuthConfig​(java.lang.String layer, java.lang.String appContext, javax.security.auth.callback.CallbackHandler handler)
      Returns the client-side authentication configuration for the specified layer and application context.
      ServerAuthConfig getServerAuthConfig​(java.lang.String layer, java.lang.String appContext, javax.security.auth.callback.CallbackHandler handler)
      Returns the server-side authentication configuration for the specified layer and application context.
      void refresh()
      Refreshes the configuration, reloading any changed settings from the underlying source.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • SimpleAuthConfigProvider

        public SimpleAuthConfigProvider​(java.util.Map<java.lang.String,​java.lang.Object> properties,
                                        AuthConfigFactory factory)
        Creates a new SimpleAuthConfigProvider.
        Parameters:
        properties - Properties to pass to the ServerAuthConfig
        factory - AuthConfigFactory to register this provider with, or null
    • Method Detail

      • getClientAuthConfig

        public ClientAuthConfig getClientAuthConfig​(java.lang.String layer,
                                                    java.lang.String appContext,
                                                    javax.security.auth.callback.CallbackHandler handler)
                                             throws AuthException
        Returns the client-side authentication configuration for the specified layer and application context.

        This implementation does not support client-side authentication and therefore always returns null.

        Specified by:
        getClientAuthConfig in interface AuthConfigProvider
        Parameters:
        layer - the message layer
        appContext - the application context
        handler - the callback handler for obtaining sensitive configuration data
        Returns:
        the ClientAuthConfig, or null if no configuration is available
        Throws:
        AuthException - if an error occurs while retrieving the configuration
      • getServerAuthConfig

        public ServerAuthConfig getServerAuthConfig​(java.lang.String layer,
                                                    java.lang.String appContext,
                                                    javax.security.auth.callback.CallbackHandler handler)
                                             throws AuthException
        Returns the server-side authentication configuration for the specified layer and application context.

        The returned ServerAuthConfig is created lazily and cached.

        Specified by:
        getServerAuthConfig in interface AuthConfigProvider
        Parameters:
        layer - the message layer
        appContext - the application context
        handler - the callback handler for obtaining sensitive configuration data
        Returns:
        the ServerAuthConfig, or null if no configuration is available
        Throws:
        AuthException - if an error occurs while retrieving the configuration
      • createServerAuthConfig

        protected ServerAuthConfig createServerAuthConfig​(java.lang.String layer,
                                                          java.lang.String appContext,
                                                          javax.security.auth.callback.CallbackHandler handler,
                                                          java.util.Map<java.lang.String,​java.lang.Object> properties)
        Creates the ServerAuthConfig. Can be overridden by subclasses to provide a custom implementation.
        Parameters:
        layer - Message layer
        appContext - Application context
        handler - Callback handler
        properties - Configuration properties
        Returns:
        The ServerAuthConfig instance
      • refresh

        public void refresh()
        Refreshes the configuration, reloading any changed settings from the underlying source.

        Delegates refresh to the cached ServerAuthConfig if one has been created.

        Specified by:
        refresh in interface AuthConfigProvider