Class CDORestAuthenticationException

All Implemented Interfaces:
Serializable

public final class CDORestAuthenticationException extends CDORestException
Reports missing or invalid authentication information at the REST boundary.

The exception always maps to HTTP 401 and carries only a safe client-visible explanation. An optional challenge is copied to the WWW-Authenticate response header after rejecting header-injection characters.

Author:
Eike Stepper
See Also:
  • Constructor Details

    • CDORestAuthenticationException

      public CDORestAuthenticationException(String message)
      Creates an authentication failure without an HTTP challenge.
      Parameters:
      message - a safe explanation suitable for transmission to an HTTP caller
    • CDORestAuthenticationException

      public CDORestAuthenticationException(String message, String challenge)
      Creates an authentication failure with an optional HTTP authentication challenge.
      Parameters:
      message - a safe explanation suitable for transmission to an HTTP caller
      challenge - the value for WWW-Authenticate, or null when no challenge applies
      Throws:
      IllegalArgumentException - if the challenge contains a carriage return or line feed
      NullPointerException - if message is null
  • Method Details

    • getChallenge

      public String getChallenge()
      Returns the optional value to send in the WWW-Authenticate response header.
      Returns:
      the challenge, or null when no challenge is available