AuthType

zio.http.endpoint.AuthType
See theAuthType companion object
sealed trait AuthType

Describes the authentication type for an Endpoint.

When authentication fails at runtime, the endpoint responds with unauthorizedStatus, which defaults to Status.NotFound (404). This is an intentional security pattern (information hiding) that prevents attackers from discovering protected resources. To use a different status:

Endpoint(Method.GET / "secret")
 .auth(AuthType.Bearer)
 .unauthorizedStatus(Status.Unauthorized) // respond with 401 instead

Attributes

Companion
object
Source
AuthType.scala
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
object Basic
object Bearer
class Custom[ClientReq]
object Digest
object None
class Or[ClientReq1, ClientReq2, ClientReq]
class ScopedAuth[ClientReq]
class WithStatus[ClientReq]
Show all
Self type

Members list

Type members

Types

Attributes

Source
AuthType.scala

Value members

Abstract methods

Concrete methods

The HTTP status code returned when authentication fails. Defaults to Status.NotFound (404) for security (information hiding). Override with withUnauthorizedStatus to use e.g. Status.Unauthorized (401).

The HTTP status code returned when authentication fails. Defaults to Status.NotFound (404) for security (information hiding). Override with withUnauthorizedStatus to use e.g. Status.Unauthorized (401).

Attributes

Source
AuthType.scala

Returns a copy of this auth type with a different unauthorized status.

Returns a copy of this auth type with a different unauthorized status.

AuthType.Bearer.withUnauthorizedStatus(Status.Unauthorized)

Attributes

Source
AuthType.scala
def |[ClientReq2, ClientReq](that: AuthType { type ClientRequirement = ClientReq2; })(implicit alternator: WithOut[ClientRequirement, ClientReq2, ClientReq]): AuthType { type ClientRequirement = ClientReq; }

Attributes

Source
AuthType.scala