Module org.firebirdsql.jaybird
Package org.firebirdsql.gds.ng.wire.auth

# Interface AuthenticationPlugin

public interface AuthenticationPlugin
Plugin for Firebird authentication.

Since:
  3.0
Author:
  Mark Rotteveel

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Interface
  Description
  `static enum`
  `AuthenticationPlugin.AuthStatus`
  Status of authentication.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `AuthenticationPlugin.AuthStatus`
  `authenticate(ClientAuthBlock clientAuthBlock)`
  Authenticate using the plugin.
  `boolean`
  `generatesSessionKey()`
  `byte[]`
  `getClientData()`
  `String`
  `getName()`
  `byte[]`
  `getSessionKey()`
  Session key for encryption.
  `boolean`
  `hasServerData()`
  `void`
  `setServerData(byte[] serverData)`
  Sets data received from the server.

- ## Method Details

  - ### getName

    String getName()
    Returns:
      Name of the plugin as used by Firebird

  - ### authenticate

    AuthenticationPlugin.AuthStatus authenticate(ClientAuthBlock clientAuthBlock) throws SQLException
    Authenticate using the plugin.

    The data generated by this method should be stored and available for calls from `getClientData()`.

    The method authenticate may be called multiple times depending on the state of the authentication (as indicated by the returned `AuthenticationPlugin.AuthStatus`.

    Parameters:
      `clientAuthBlock` - Client authentication block.
    Returns:
      Status of the authentication
    Throws:
      `SQLException` - For authentication failures

  - ### getClientData

    byte[] getClientData()
    Returns:
      The data generated by a call to `authenticate(ClientAuthBlock)`.

  - ### setServerData

    void setServerData(byte[] serverData)
    Sets data received from the server.
    Parameters:
      `serverData` - Server data

  - ### hasServerData

    boolean hasServerData()
    Returns:
      `true` if plugin has non-null and non-empty server data

  - ### generatesSessionKey

    boolean generatesSessionKey()
    Returns:
      `true` if the plugin generates a session key

  - ### getSessionKey

    byte[] getSessionKey() throws SQLException
    Session key for encryption.
    Returns:
      Session key
    Throws:
      `SQLException` - If there is currently no session key or the authentication plugin doesn't support session key generation.