Package org.keycloak.vault
Class DefaultVaultCharSecret
- java.lang.Object
-
- org.keycloak.vault.DefaultVaultCharSecret
-
- All Implemented Interfaces:
AutoCloseable
,VaultCharSecret
public class DefaultVaultCharSecret extends Object implements VaultCharSecret
DefaultVaultCharSecret
implementation based onCharBuffer
.- Author:
- Stefan Guilhen
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Destroys the secret in memory by e.g.static VaultCharSecret
forBuffer(Optional<CharBuffer> buffer)
Optional<CharBuffer>
get()
Returns the secret enclosed in aCharBuffer
.Optional<char[]>
getAsArray()
Returns the secret in itschar[]
form.
-
-
-
Method Detail
-
forBuffer
public static VaultCharSecret forBuffer(Optional<CharBuffer> buffer)
-
get
public Optional<CharBuffer> get()
Description copied from interface:VaultCharSecret
Returns the secret enclosed in aCharBuffer
.- Specified by:
get
in interfaceVaultCharSecret
- Returns:
- If the secret was successfully resolved by vault, returns an
Optional
containing the value returned by the vault as aCharBuffer
(a valid value can benull
), or an emptyOptional
-
getAsArray
public Optional<char[]> getAsArray()
Description copied from interface:VaultCharSecret
Returns the secret in itschar[]
form.- Specified by:
getAsArray
in interfaceVaultCharSecret
- Returns:
- If the secret was successfully resolved by vault, returns an
Optional
containing the value returned by the vault as achar[]
(a valid value can benull
), or an emptyOptional
.
-
close
public void close()
Description copied from interface:VaultCharSecret
Destroys the secret in memory by e.g. overwriting it with random garbage.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceVaultCharSecret
-
-