# Class SecretKeyCallback

java.lang.Object
jakarta.security.auth.message.callback.SecretKeyCallback

All Implemented Interfaces:
  `Callback`

public class SecretKeyCallback extends Object implements Callback
A callback enabling an authentication module to request a secret key from the runtime, by supplying an alias. Other request types may also be supported.

- ## Nested Class Summary

  Nested Classes
  Modifier and Type
  Class
  Description
  `static class`
  `SecretKeyCallback.AliasRequest`
  A request for a secret key identified by its alias.
  `static interface`
  `SecretKeyCallback.Request`
  Represents a request for a secret key.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `SecretKeyCallback(SecretKeyCallback.Request request)`
  Constructs a SecretKeyCallback with the specified request.

- ## Method Summary

  Modifier and Type
  Method
  Description
  `SecretKey`
  `getKey()`
  Returns the secret key.
  `SecretKeyCallback.Request`
  `getRequest()`
  Returns the request associated with this callback.
  `void`
  `setKey(SecretKey key)`
  Sets the secret key obtained by the runtime.

  ### Methods inherited from class Object

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

- ## Constructor Details

  - ### SecretKeyCallback

    public SecretKeyCallback(SecretKeyCallback.Request request)
    Constructs a SecretKeyCallback with the specified request.
    Parameters:
      `request` - The request describing the secret key to obtain

- ## Method Details

  - ### getRequest

    public SecretKeyCallback.Request getRequest()
    Returns the request associated with this callback.
    Returns:
      The request describing the secret key to obtain

  - ### setKey

    public void setKey(SecretKey key)
    Sets the secret key obtained by the runtime.
    Parameters:
      `key` - The secret key

  - ### getKey

    public SecretKey getKey()
    Returns the secret key.
    Returns:
      The secret key, or `null` if not set