Class AuthDomainDigest

All Implemented Interfaces:
Proxy

@Generated("org.javagi.JavaGI") public final class AuthDomainDigest extends AuthDomain

Server-side "Digest" authentication.

AuthDomainDigest handles the server side of HTTP "Digest" authentication.

  • Constructor Details

    • AuthDomainDigest

      public AuthDomainDigest(MemorySegment address)
      Create a AuthDomainDigest instance for the provided memory address.
      Parameters:
      address - the memory address of the native object
    • AuthDomainDigest

      public AuthDomainDigest(String optname1, Object... varargs)

      Creates a AuthDomainDigest.

      You must set the AuthDomain:realm property, to indicate the realm name to be returned with the authentication challenge to the client. Other parameters are optional.

      Parameters:
      optname1 - name of first option, or null
      varargs - option name/value pairs
    • AuthDomainDigest

      public AuthDomainDigest()
      Create a new AuthDomainDigest.
  • Method Details

    • getType

      public static @Nullable Type getType()
      Get the GType of the AuthDomainDigest class.
      Returns:
      the GType
    • getMemoryLayout

      public static MemoryLayout getMemoryLayout()
      The memory layout of the native struct.
      Returns:
      the memory layout
    • asParent

      protected AuthDomainDigest asParent()
      Return this instance as if it were its parent type. Comparable to the Java super keyword, but ensures the parent typeclass is also used in native code.
      Overrides:
      asParent in class AuthDomain
      Returns:
      the instance as if it were its parent type
    • encodePassword

      public static String encodePassword(String username, String realm, String password)

      Encodes the username/realm/password triplet for Digest authentication.

      That is, it returns a stringified MD5 hash of username, realm, and password concatenated together. This is the form that is needed as the return value of AuthDomainDigest's auth handler.

      For security reasons, you should store the encoded hash, rather than storing the cleartext password itself and calling this method only when you need to verify it. This way, if your server is compromised, the attackers will not gain access to cleartext passwords which might also be usable at other sites. (Note also that the encoded password returned by this method is identical to the encoded password stored in an Apache .htdigest file.)

      Parameters:
      username - a username
      realm - an auth realm name
      password - the password for username in realm
      Returns:
      the encoded password
    • setAuthCallback

      public void setAuthCallback(@Nullable AuthDomainDigestAuthCallback callback)

      Sets the callback that this AuthDomainDigest will use to authenticate incoming requests.

      For each request containing authorization, this AuthDomainDigest will invoke the callback, and then either accept or reject the request based on callback's return value.

      You can also set the auth callback by setting the AuthDomainDigest:auth-callback and AuthDomainDigest:auth-data properties, which can also be used to set the callback at construct time.

      Parameters:
      callback - the callback
    • builder

      public static AuthDomainDigest.Builder<? extends AuthDomainDigest.Builder> builder()
      A AuthDomainDigest.Builder object constructs a AuthDomainDigest with the specified properties. Use the various set...() methods to set properties, and finish construction with AuthDomainDigest.Builder.build().
      Returns:
      the builder object