com.tibbo.aggregate.common.plugin.auth

## Class AuthenticationPluginDecorator

- java.lang.Object
- - com.tibbo.aggregate.common.plugin.auth.AuthenticationPluginDecorator

- All Implemented Interfaces:
    AggreGatePlugin, AuthenticationPlugin

      public class AuthenticationPluginDecorator
      extends java.lang.Object
      implements AuthenticationPlugin

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `AuthenticationPluginDecorator(AuthenticationPlugin authenticationPlugin)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `AuthenticationResult` | `authenticate(java.util.Map<AuthenticationParams,java.lang.Object> params)` Tries to authenticate a user.
    `Context` | `createGlobalConfigContext(Context rootContext, boolean requestReboot, VariableDefinition... properties)` This method creates and returns context containing plugin's global configuration.
    `Context` | `createUserConfigContext(Context userContext, boolean requestReboot, VariableDefinition... properties)` This method creates and returns context containing plugin's user-level configuration.
    `java.lang.String` | `getDescription()` Returns plugin description
    `Context` | `getGlobalConfigContext()` Returns plugin's global configuration context
    `java.lang.String` | `getId()` Returns plugin ID
    `java.lang.String` | `getShortId()` Returns plugin short ID (last "segment" of full ID).
    `int` | `getSortIndex()` Returns sort index used to sort plugins in the list.
    `Context` | `getUserConfigContext(java.lang.String username)` Returns plugin's user-level configuration context or NULL if user-level configuration is disabled for the user.
    `void` | `globalDeinit(Context rootContext)` This method is called once during server shutdown.
    `void` | `globalInit(Context rootContext)` This method is called once during server startup.
    `void` | `globalStart()` This method is called once for every plugin at the moment when server context tree is fully initialized and all contexts are available.
    `void` | `globalStop()` This method is called once for every plugin upon server shutdown.
    `boolean` | `isAuthenticationByPassword()`
    `void` | `logout(java.util.Map<AuthenticationParams,java.lang.Object> params)` Logout external session
    `AuthenticationResult` | `refreshToken(com.google.common.collect.ImmutableMap<AuthenticationParams,java.lang.Object> params)`
    `void` | `userDeinit(Context userContext)` This method is called once for every system user upon its deletion or server shutdown.
    `void` | `userInit(Context userContext)` This method is called once for every system user upon its creation or server startup.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### AuthenticationPluginDecorator

          public AuthenticationPluginDecorator(AuthenticationPlugin authenticationPlugin)

  - ### Method Detail

    - #### getId

          public java.lang.String getId()

      Description copied from interface: `AggreGatePlugin`
      Returns plugin ID
      Specified by:
        `getId` in interface `AggreGatePlugin`
      Returns:
        Plugin ID

    - #### getShortId

          public java.lang.String getShortId()

      Description copied from interface: `AggreGatePlugin`
      Returns plugin short ID (last "segment" of full ID).
      Specified by:
        `getShortId` in interface `AggreGatePlugin`
      Returns:
        Plugin short ID

    - #### getDescription

          public java.lang.String getDescription()

      Description copied from interface: `AggreGatePlugin`
      Returns plugin description
      Specified by:
        `getDescription` in interface `AggreGatePlugin`
      Returns:
        Plugin description

    - #### getSortIndex

          public int getSortIndex()

      Description copied from interface: `AggreGatePlugin`
      Returns sort index used to sort plugins in the list. Plugins with zero sort index are used according to their descriptions.
      Specified by:
        `getSortIndex` in interface `AggreGatePlugin`
      Returns:
        Plugin sort index

    - #### globalInit

          public void globalInit(Context rootContext)
                          throws PluginException

      Description copied from interface: `AggreGatePlugin`
      This method is called once during server startup. Its implementation will in most cases call createGlobalConfigContext() to create plugin global configuration. Another typical use is opening some listening server socket to accept connections or receive network datagrams. Note, that this method is called during server context tree initialization. Not all server contexts may be available at the time of its call. To access any server context during plugin startup, override globalStart() method.
      Specified by:
        `globalInit` in interface `AggreGatePlugin`
      Throws:
        `PluginException` - If an error occurred during initialization

    - #### userInit

          public void userInit(Context userContext)
                        throws PluginException

      Description copied from interface: `AggreGatePlugin`
      This method is called once for every system user upon its creation or server startup. Its implementation will in most cases call createUserConfigContext() to create plugin user-level configuration. This method won't be called if user-level configuration is disabled for the user.
      Specified by:
        `userInit` in interface `AggreGatePlugin`
      Throws:
        `PluginException` - If an error occurred during initialization

    - #### globalDeinit

          public void globalDeinit(Context rootContext)
                            throws PluginException

      Description copied from interface: `AggreGatePlugin`
      This method is called once during server shutdown. It's usually used to terminate any threads created by the plugin and close all server sockets opened by it.
      Specified by:
        `globalDeinit` in interface `AggreGatePlugin`
      Throws:
        `PluginException` - If an error occurred during de-initialization

    - #### userDeinit

          public void userDeinit(Context userContext)
                          throws PluginException

      Description copied from interface: `AggreGatePlugin`
      This method is called once for every system user upon its deletion or server shutdown. The method will be called even if user-level configuration is disabled for the user.
      Specified by:
        `userDeinit` in interface `AggreGatePlugin`
      Throws:
        `PluginException` - If an error occurred during de-initialization

    - #### globalStart

          public void globalStart()
                           throws PluginException

      Description copied from interface: `AggreGatePlugin`
      This method is called once for every plugin at the moment when server context tree is fully initialized and all contexts are available.
      Specified by:
        `globalStart` in interface `AggreGatePlugin`
      Throws:
        `PluginException` - If an error occurred during plugin startup

    - #### globalStop

          public void globalStop()
                          throws PluginException

      Description copied from interface: `AggreGatePlugin`
      This method is called once for every plugin upon server shutdown.
      Specified by:
        `globalStop` in interface `AggreGatePlugin`
      Throws:
        `PluginException` - If an error occurred during plugin shutdown

    - #### createGlobalConfigContext

          public Context createGlobalConfigContext(Context rootContext,
                                                   boolean requestReboot,
                                                   VariableDefinition... properties)

      Description copied from interface: `AggreGatePlugin`
      This method creates and returns context containing plugin's global configuration. There is no need to keep reference to this context for future use as it may be accessed via getGlobalConfigContext() method.
      Specified by:
        `createGlobalConfigContext` in interface `AggreGatePlugin`
      Parameters:
        `rootContext` - Server root context
        `requestReboot` - Prompt an operator to reboot server after a global plugin property change
        `properties` - List of global plugin properties
      Returns:
        Plugin global config context

    - #### createUserConfigContext

          public Context createUserConfigContext(Context userContext,
                                                 boolean requestReboot,
                                                 VariableDefinition... properties)

      Description copied from interface: `AggreGatePlugin`
      This method creates and returns context containing plugin's user-level configuration. There is no need to keep reference to this context for future use as it may be accessed via getUserConfigContext() method.
      Specified by:
        `createUserConfigContext` in interface `AggreGatePlugin`
      Parameters:
        `userContext` - Context of user to associate the configuration with
        `requestReboot` - Prompt an operator to reboot server after a global plugin property change
        `properties` - List of user-level plugin properties
      Returns:
        Plugin user-level config context

    - #### getGlobalConfigContext

          public Context getGlobalConfigContext()

      Description copied from interface: `AggreGatePlugin`
      Returns plugin's global configuration context
      Specified by:
        `getGlobalConfigContext` in interface `AggreGatePlugin`
      Returns:
        Global configuration context

    - #### getUserConfigContext

          public Context getUserConfigContext(java.lang.String username)

      Description copied from interface: `AggreGatePlugin`
      Returns plugin's user-level configuration context or NULL if user-level configuration is disabled for the user.
      Specified by:
        `getUserConfigContext` in interface `AggreGatePlugin`
      Returns:
        User-level configuration context

    - #### authenticate

          public AuthenticationResult authenticate(java.util.Map<AuthenticationParams,java.lang.Object> params)
                                            throws PluginException,
                                                   ContextException

      Description copied from interface: `AuthenticationPlugin`
      Tries to authenticate a user. The external authentication plugin must check validity of user credentials and return an internal username of the authenticated user.
      Specified by:
        `authenticate` in interface `AuthenticationPlugin`
      Parameters:
        `params` - Authentication params
      Returns:
        Authentication result
      Throws:
        `PluginException`
        `ContextException`

    - #### isAuthenticationByPassword

          public boolean isAuthenticationByPassword()

      Specified by:
        `isAuthenticationByPassword` in interface `AuthenticationPlugin`

    - #### refreshToken

          public AuthenticationResult refreshToken(com.google.common.collect.ImmutableMap<AuthenticationParams,java.lang.Object> params)
                                            throws ContextException

      Specified by:
        `refreshToken` in interface `AuthenticationPlugin`
      Throws:
        `ContextException`

    - #### logout

          public void logout(java.util.Map<AuthenticationParams,java.lang.Object> params)
                      throws ContextException

      Description copied from interface: `AuthenticationPlugin`
      Logout external session
      Specified by:
        `logout` in interface `AuthenticationPlugin`
      Throws:
        `ContextException`