org.keycloak.vault

## Class DefaultVaultRawSecret

- java.lang.Object
- - org.keycloak.vault.DefaultVaultRawSecret

- All Implemented Interfaces:
    AutoCloseable, VaultRawSecret

      public class DefaultVaultRawSecret
      extends Object
      implements VaultRawSecret

  Default raw secret implementation for `byte[]`.
  Author:
    hmlnarik

- - ### Method Summary

    All Methods Static Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `close()` Destroys the secret in memory by e.g.
    `static VaultRawSecret` | `forBuffer(Optional<ByteBuffer> buffer)`
    `Optional<ByteBuffer>` | `get()` Returns the raw secret bytes.
    `Optional<byte[]>` | `getAsArray()` Returns the raw secret bytes in `byte[]` form.

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

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

- - ### Method Detail

    - #### forBuffer

          public static VaultRawSecret forBuffer(Optional<ByteBuffer> buffer)

    - #### get

          public Optional<ByteBuffer> get()

      Description copied from interface: `VaultRawSecret`
      Returns the raw secret bytes.
      Specified by:
        `get` in interface `VaultRawSecret`
      Returns:
        If the secret was successfully resolved by vault, returns an `Optional` containing the value returned by the vault (a valid value can be `null`), or an empty `Optional`

    - #### getAsArray

          public Optional<byte[]> getAsArray()

      Description copied from interface: `VaultRawSecret`
      Returns the raw secret bytes in `byte[]` form.
      Specified by:
        `getAsArray` in interface `VaultRawSecret`
      Returns:
        If the secret was successfully resolved by vault, returns an `Optional` containing the value returned by the vault (a valid value can be `null`), or an empty `Optional`

    - #### close

          public void close()

      Description copied from interface: `VaultRawSecret`
      Destroys the secret in memory by e.g. overwriting it with random garbage.
      Specified by:
        `close` in interface `AutoCloseable`
      Specified by:
        `close` in interface `VaultRawSecret`

Copyright © 2020 JBoss by Red Hat. All rights reserved.