Enum Class AuthType

java.lang.Object
java.lang.Enum<AuthType>
com.tnsai.enums.AuthType
All Implemented Interfaces:
Serializable, Comparable<AuthType>, Constable

public enum AuthType extends Enum<AuthType>
HTTP authentication types for WEB_SERVICE actions. All credential values are read from environment variables at runtime.
See Also:
  • Enum Constant Details

    • NO_AUTH

      public static final AuthType NO_AUTH
      No authentication required.
    • BEARER

      public static final AuthType BEARER
      Bearer Token Authentication (RFC 6750). Sends token in the Authorization header.

      Format: Authorization: Bearer {value from authToken env var}

      Requires:

      • authToken - Environment variable name for the bearer token
    • BASIC

      public static final AuthType BASIC
      Basic Authentication (RFC 7617). Sends username:password as Base64 encoded string in Authorization header.

      Format: Authorization: Basic {base64(username:password)}

      Requires:

      • authUsername - Environment variable name for username
      • authPassword - Environment variable name for password
    • API_KEY

      public static final AuthType API_KEY
      API Key Authentication. Sends the key in a custom request header named by @WebService.apiKeyHeader() (defaults to X-API-Key).

      Format: <apiKeyHeader>: {value from authTokenEnv var}

      Requires:

      • authTokenEnv - Environment variable name for the API key
      • apiKeyHeader - (Optional) custom header name; defaults to X-API-Key

      Use this when an upstream API expects a header like X-API-Key: <value> (or any custom name) rather than a standard Authorization: Bearer … token.

      Since:
      0.8.3
  • Method Details

    • values

      public static AuthType[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static AuthType valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null