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

# Class ClientAuthBlock

java.lang.Object
org.firebirdsql.gds.ng.wire.auth.ClientAuthBlock

public final class ClientAuthBlock extends Object
Manages client authentication with multiple pluginProviders.

This is similar to the `ClntAuthBlock` in Firebird. For ease of understanding, and correlating with the Firebird implementation, this uses the same (or very similar) terms and structure (if it makes sense).

Since:
  3.0
Author:
  Mark Rotteveel

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `ClientAuthBlock(IAttachProperties<?> attachProperties)`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `AuthenticationPlugin.AuthStatus`
  `authenticate()`
  `void`
  `authenticateStep0()`
  `void`
  `authFillParametersBlock(ConnectionParameterBuffer pb)`
  `byte[]`
  `getClientData()`
  `String`
  `getCurrentPluginName()`
  `String`
  `getLogin()`
  `String`
  `getNormalizedLogin()`
  `String`
  `getPassword()`
  `String`
  `getPluginNames()`
  `byte[]`
  `getSessionKey()`
  `boolean`
  `hasPlugin()`
  `boolean`
  `isAuthComplete()`
  `boolean`
  `isFirstTime()`
  `void`
  `resetClient(byte[] serverInfo)`
  `void`
  `setAuthComplete(boolean authComplete)`
  `void`
  `setFirstTime(boolean firstTime)`
  `void`
  `setServerData(byte[] serverData)`
  `boolean`
  `supportsEncryption()`
  TODO Need to handle this differently
  `boolean`
  `switchPlugin(String pluginName)`
  `void`
  `writePluginDataTo(OutputStream userId)`

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

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

- ## Constructor Details

  - ### ClientAuthBlock

    public ClientAuthBlock(IAttachProperties<?> attachProperties) throws SQLException
    Throws:
      `SQLException`

- ## Method Details

  - ### getLogin

    public String getLogin()

  - ### getNormalizedLogin

    public String getNormalizedLogin()

  - ### getPassword

    public String getPassword()

  - ### isAuthComplete

    public boolean isAuthComplete()

  - ### setAuthComplete

    public void setAuthComplete(boolean authComplete)

  - ### getCurrentPluginName

    public String getCurrentPluginName()

  - ### getPluginNames

    public String getPluginNames()
    Returns:
      Comma separated list of available plugins.

  - ### getClientData

    public byte[] getClientData()

  - ### setFirstTime

    public void setFirstTime(boolean firstTime)

  - ### isFirstTime

    public boolean isFirstTime()

  - ### authenticateStep0

    public void authenticateStep0() throws SQLException
    Throws:
      `SQLException`

  - ### resetClient

    public void resetClient(byte[] serverInfo) throws SQLException
    Throws:
      `SQLException`

  - ### setServerData

    public void setServerData(byte[] serverData)

  - ### writePluginDataTo

    public void writePluginDataTo(OutputStream userId) throws IOException
    Throws:
      `IOException`

  - ### switchPlugin

    public boolean switchPlugin(String pluginName)

  - ### hasPlugin

    public boolean hasPlugin()

  - ### authenticate

    public AuthenticationPlugin.AuthStatus authenticate() throws SQLException
    Throws:
      `SQLException`

  - ### authFillParametersBlock

    public void authFillParametersBlock(ConnectionParameterBuffer pb) throws SQLException
    Throws:
      `SQLException`

  - ### supportsEncryption

    public boolean supportsEncryption() throws SQLException
    TODO Need to handle this differently
    Returns:
      `true` if the encryption is supported
    Throws:
      `SQLException` - If it is impossible to determine if encryption is supported (e.g. there is no current auth plugin)

  - ### getSessionKey

    public byte[] getSessionKey() throws SQLException
    Returns:
      Session key
    Throws:
      `SQLException` - If a session key cannot be provided