Middleware

zio.http.api.Middleware$
See theMiddleware companion trait
object Middleware

Attributes

Companion:
trait
Graph
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type

Members list

Concise view

Type members

Classlikes

object Control

Attributes

Companion:
trait
Graph
Supertypes
trait Sum
trait Mirror
class Object
trait Matchable
class Any
Self type
Control.type
sealed trait Control[+State]

Attributes

Companion:
object
Graph
Supertypes
class Object
trait Matchable
class Any
Known subtypes
class Abort[State]
class Continue[State]
Self type
Control[State]
final class Interceptor1[S](val dummy: Boolean) extends AnyVal

Attributes

Graph
Supertypes
class AnyVal
trait Matchable
class Any
class Interceptor2[S, R, I, O](spec: MiddlewareSpec[I, O], incoming: I => ZIO[R, Nothing, Control[S]])

Attributes

Graph
Supertypes
class Object
trait Matchable
class Any

Inherited types

The names of the product elements

The names of the product elements

Attributes

Inherited from:
Mirror

The name of the type

The name of the type

Attributes

Inherited from:
Mirror

Value members

Concrete methods

Sets cookie in response headers

Sets cookie in response headers

Attributes

def addCookieZIO[R](cookie: ZIO[R, Nothing, Cookie[Response]]): Middleware[R, Unit, Cookie[Response]]
def addHeader(header: Header): Middleware[Any, Unit, Unit]
def addHeaders(headers: Headers): Middleware[Any, Unit, Unit]
final def basicAuth(f: Credentials => Boolean)(implicit trace: Trace): Middleware[Any, Authorization, Unit]

Creates a middleware for basic authentication

Creates a middleware for basic authentication

Attributes

final def basicAuth(u: String, p: String)(implicit trace: Trace): Middleware[Any, Authorization, Unit]

Creates a middleware for basic authentication that checks if the credentials are same as the ones given

Creates a middleware for basic authentication that checks if the credentials are same as the ones given

Attributes

def basicAuthZIO[R](f: Credentials => ZIO[R, Nothing, Boolean])(implicit trace: Trace): Middleware[R, Authorization, Unit]

Creates a middleware for basic authentication using an effectful verification function

Creates a middleware for basic authentication using an effectful verification function

Attributes

final def bearerAuth(f: String => Boolean)(implicit trace: Trace): Middleware[Any, Authorization, Unit]

Creates a middleware for bearer authentication that checks the token using the given function

Creates a middleware for bearer authentication that checks the token using the given function

Attributes

f

: function that validates the token string inside the Bearer Header

final def bearerAuthZIO[R](f: String => ZIO[R, Nothing, Boolean])(implicit trace: Trace): Middleware[R, Authorization, Unit]

Creates a middleware for bearer authentication that checks the token using the given effectful function

Creates a middleware for bearer authentication that checks the token using the given effectful function

Attributes

f

: function that effectfully validates the token string inside the Bearer Header

Creates a middleware for Cross-Origin Resource Sharing (CORS).

Creates a middleware for Cross-Origin Resource Sharing (CORS).

Attributes

See also:
final def csrfGenerate[R, E](tokenName: String, tokenGen: ZIO[R, Nothing, String])(implicit trace: Trace): Middleware[R, Unit, Cookie[Response]]

Generates a new CSRF token that can be validated using the csrfValidate middleware.

Generates a new CSRF token that can be validated using the csrfValidate middleware.

CSRF middlewares: To prevent Cross-site request forgery attacks. This middleware is modeled after the double submit cookie pattern. Used in conjunction with csrfValidate middleware.

https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#double-submit-cookie

Attributes

Validates the CSRF token appearing in the request headers. Typically the token should be set using the csrfGenerate middleware.

Validates the CSRF token appearing in the request headers. Typically the token should be set using the csrfGenerate middleware.

CSRF middlewares : To prevent Cross-site request forgery attacks. This middleware is modeled after the double submit cookie pattern. Used in conjunction with csrfGenerate middleware

https://cheatsheetseries.owasp.org/cheatsheets/Cross-Site_Request_Forgery_Prevention_Cheat_Sheet.html#double-submit-cookie

Attributes

def customAuth[R, I](headerCodec: HeaderCodec[I])(verify: I => Boolean): Middleware[R, I, Unit]

Creates an authentication middleware that only allows authenticated requests to be passed on to the app.

Creates an authentication middleware that only allows authenticated requests to be passed on to the app.

Attributes

def customAuthZIO[R, I](headerCodec: HeaderCodec[I], responseHeaders: Headers, responseStatus: Status)(verify: I => ZIO[R, Nothing, Boolean])(implicit trace: Trace): Middleware[R, I, Unit]

Creates an authentication middleware that only allows authenticated requests to be passed on to the app using an effectful verification function.

Creates an authentication middleware that only allows authenticated requests to be passed on to the app using an effectful verification function.

Attributes

def fromFunction[A, B](spec: MiddlewareSpec[A, B])(f: A => B): Middleware[Any, A, B]
def fromFunctionZIO[R, A, B](spec: MiddlewareSpec[A, B])(f: A => ZIO[R, Nothing, B]): Middleware[R, A, B]
def intercept[S, R, I, O](spec: MiddlewareSpec[I, O])(incoming: I => Control[S])(outgoing: (S, Response) => O): Middleware[R, I, O]
def withAccept(value: CharSequence): Middleware[Any, Unit, Accept]
def withAcceptEncoding(value: CharSequence): Middleware[Any, Unit, AcceptEncoding]
def withAcceptLanguage(value: CharSequence): Middleware[Any, Unit, AcceptLanguage]
def withAcceptPatch(value: CharSequence): Middleware[Any, Unit, AcceptPatch]
def withAcceptRanges(value: CharSequence): Middleware[Any, Unit, AcceptRanges]
def withAccessControlAllowMaxAge(value: CharSequence): Middleware[Any, Unit, Unit]
def withAccessControlAllowMethods(value: CharSequence): Middleware[Any, Unit, Unit]
def withAccessControlAllowOrigin(value: CharSequence): Middleware[Any, Unit, Unit]
def withConnection(value: CharSequence): Middleware[Any, Unit, Unit]

Adds the content base header to the response with the given value.

Adds the content base header to the response with the given value.

Attributes

def withContentBase(value: CharSequence): Middleware[Any, Unit, Unit]

Adds the content base header to the response with the given value, if it is valid. Else, it add an empty value.

Adds the content base header to the response with the given value, if it is valid. Else, it add an empty value.

Attributes

def withContentBaseZIO[R, A](value: ZIO[R, Nothing, A])(implicit ev: A <:< ContentBase): Middleware[R, Unit, ContentBase]

Adds the content base header to the response with the value computed by the given effect.

Adds the content base header to the response with the value computed by the given effect.

Attributes

def withContentBaseZIO[R](value: ZIO[R, Nothing, CharSequence]): Middleware[R, Unit, ContentBase]

Adds the content base header to the response with the value computed by the given effect, if it is valid. Else, it add an empty value.

Adds the content base header to the response with the value computed by the given effect, if it is valid. Else, it add an empty value.

Attributes

Adds the content disposition header to the response with the given value.

Adds the content disposition header to the response with the given value.

Attributes

def withContentDisposition(value: CharSequence): Middleware[Any, Unit, Unit]

Adds the content disposition header to the response with the given value, if it is valid. Else, it adds an empty value.

Adds the content disposition header to the response with the given value, if it is valid. Else, it adds an empty value.

Attributes

def withContentDispositionZIO[R, A](value: ZIO[R, Nothing, A])(implicit ev: A <:< ContentDisposition): Middleware[R, Unit, ContentDisposition]

Adds the content disposition header to the response with the value computed by the given effect.

Adds the content disposition header to the response with the value computed by the given effect.

Attributes

def withContentDispositionZIO[R](value: ZIO[R, Nothing, CharSequence]): Middleware[R, Unit, ContentDisposition]

Adds the content disposition header to the response with the value computed by the given effect, if it is valid. Else, it adds an empty value.

Adds the content disposition header to the response with the value computed by the given effect, if it is valid. Else, it adds an empty value.

Attributes

Adds the content encoding header to the response with the given value.

Adds the content encoding header to the response with the given value.

Attributes

def withContentEncoding(value: CharSequence): Middleware[Any, Unit, Unit]

Adds the content encoding header to the response with the given value, if it is valid. Else, it adds an empty value.

Adds the content encoding header to the response with the given value, if it is valid. Else, it adds an empty value.

Attributes

def withContentEncodingZIO[R, A](value: ZIO[R, Nothing, A])(implicit ev: A <:< ContentEncoding): Middleware[R, Unit, ContentEncoding]

Adds the content encoding header to the response with the value computed by the given effect.

Adds the content encoding header to the response with the value computed by the given effect.

Attributes

def withContentEncodingZIO[R](value: ZIO[R, Nothing, CharSequence]): Middleware[R, Unit, ContentEncoding]

Adds the content encoding header to the response with the value computed by the given effect, if it is valid. Else, it adds an empty value.

Adds the content encoding header to the response with the value computed by the given effect, if it is valid. Else, it adds an empty value.

Attributes

Adds the content language header to the response with the given value.

Adds the content language header to the response with the given value.

Attributes

def withContentLanguage(value: CharSequence): Middleware[Any, Unit, Unit]

Adds the content language header to the response with the given value, if it is valid. Else, it adds an empty value.

Adds the content language header to the response with the given value, if it is valid. Else, it adds an empty value.

Attributes

def withContentLanguageZIO[R, A](value: ZIO[R, Nothing, A])(implicit ev: A <:< ContentLanguage): Middleware[R, Unit, ContentLanguage]

Adds the content language header to the response with the value computed by the given effect.

Adds the content language header to the response with the value computed by the given effect.

Attributes

def withContentLanguageZIO[R](value: ZIO[R, Nothing, CharSequence]): Middleware[R, Unit, ContentLanguage]

Adds the content language header to the response with the value computed by the given effect, if it is valid. Else, it adds an empty value.

Adds the content language header to the response with the value computed by the given effect, if it is valid. Else, it adds an empty value.

Attributes

Adds the content length header to the response with the given value.

Adds the content length header to the response with the given value.

Attributes

Adds the content length header to the response with the given value, if it is valid. Else, it adds an empty value.

Adds the content length header to the response with the given value, if it is valid. Else, it adds an empty value.

Attributes

def withContentLengthZIO[R, A](value: ZIO[R, Nothing, A])(implicit ev: A <:< ContentLength): Middleware[R, Unit, ContentLength]

Adds the content length header to the response with the value computed by the given effect.

Adds the content length header to the response with the value computed by the given effect.

Attributes

def withContentLengthZIO[R](value: ZIO[R, Nothing, Long]): Middleware[R, Unit, ContentLength]

Adds the content length header to the response with the value computed by the given effect, if it is valid. Else, it adds an empty value.

Adds the content length header to the response with the value computed by the given effect, if it is valid. Else, it adds an empty value.

Attributes

Adds the content location header to the response with the given value.

Adds the content location header to the response with the given value.

Attributes

def withContentLocation(value: CharSequence): Middleware[Any, Unit, Unit]

Adds the content location header to the response with the given value, if it is valid. Else, it adds an empty value.

Adds the content location header to the response with the given value, if it is valid. Else, it adds an empty value.

Attributes

def withContentLocationZIO[R, A](value: ZIO[R, Nothing, A])(implicit ev: A <:< ContentLocation): Middleware[R, Unit, ContentLocation]

Adds the content location header to the response with the value computed by the given effect.

Adds the content location header to the response with the value computed by the given effect.

Attributes

def withContentLocationZIO[R](value: ZIO[R, Nothing, CharSequence]): Middleware[R, Unit, ContentLocation]

Adds the content location header to the response with the value computed by the given effect, if it is valid. Else, it adds an empty value.

Adds the content location header to the response with the value computed by the given effect, if it is valid. Else, it adds an empty value.

Attributes

Adds the content md5 header to the response with the given value.

Adds the content md5 header to the response with the given value.

Attributes

def withContentMd5(value: CharSequence): Middleware[Any, Unit, Unit]

Adds the content md5 header to the response with the given value, if it is valid. Else, it adds an empty value.

Adds the content md5 header to the response with the given value, if it is valid. Else, it adds an empty value.

Attributes

def withContentMd5ZIO[R, A](value: ZIO[R, Nothing, A])(implicit ev: A <:< ContentMd5): Middleware[R, Unit, ContentMd5]

Adds the content md5 header to the response with the value computed by the given effect.

Adds the content md5 header to the response with the value computed by the given effect.

Attributes

def withContentMd5ZIO[R](value: ZIO[R, Nothing, CharSequence]): Middleware[R, Unit, ContentMd5]

Adds the content md5 header to the response with the value computed by the given effect, if it is valid. Else, it adds an empty value.

Adds the content md5 header to the response with the value computed by the given effect, if it is valid. Else, it adds an empty value.

Attributes

Adds the content range header to the response with the given value.

Adds the content range header to the response with the given value.

Attributes

def withContentRange(value: CharSequence): Middleware[Any, Unit, Unit]

Adds the content range header to the response with the given value, if it is valid. Else, it adds an empty value.

Adds the content range header to the response with the given value, if it is valid. Else, it adds an empty value.

Attributes

def withContentRangeZIO[R, A](value: ZIO[R, Nothing, A])(implicit ev: A <:< ContentRange): Middleware[R, Unit, ContentRange]

Adds the content range header to the response with the value computed by the given effect.

Adds the content range header to the response with the value computed by the given effect.

Attributes

def withContentRangeZIO[R](value: ZIO[R, Nothing, CharSequence]): Middleware[R, Unit, ContentRange]

Adds the content range header to the response with the value computed by the given effect, if it is valid. Else, it adds an empty value.

Adds the content range header to the response with the value computed by the given effect, if it is valid. Else, it adds an empty value.

Attributes

Adds the content security policy header to the response with the given value.

Adds the content security policy header to the response with the given value.

Attributes

def withContentSecurityPolicy(value: CharSequence): Middleware[Any, Unit, Unit]

Adds the content security policy header to the response with the given value, if it is valid. Else, it adds an empty value.

Adds the content security policy header to the response with the given value, if it is valid. Else, it adds an empty value.

Attributes

def withContentSecurityPolicyZIO[R, A](value: ZIO[R, Nothing, A])(implicit ev: A <:< ContentSecurityPolicy): Middleware[R, Unit, ContentSecurityPolicy]

Adds the content security policy header to the response with the value computed by the given effect.

Adds the content security policy header to the response with the value computed by the given effect.

Attributes

def withContentSecurityPolicyZIO[R](value: ZIO[R, Nothing, CharSequence]): Middleware[R, Unit, ContentSecurityPolicy]

Adds the content security policy header to the response with the value computed by the given effect, if it is valid. Else, it adds an empty value.

Adds the content security policy header to the response with the value computed by the given effect, if it is valid. Else, it adds an empty value.

Attributes

Adds the content transfer encoding header to the response with the given value.

Adds the content transfer encoding header to the response with the given value.

Attributes

def withContentTransferEncoding(value: CharSequence): Middleware[Any, Unit, Unit]

Adds the content transfer encoding header to the response with the given value, if it is valid. Else, it adds an empty value.

Adds the content transfer encoding header to the response with the given value, if it is valid. Else, it adds an empty value.

Attributes

Adds the content transfer encoding header to the response with the value

Adds the content transfer encoding header to the response with the value

Attributes

def withContentTransferEncodingZIO[R](value: ZIO[R, Nothing, CharSequence]): Middleware[R, Unit, ContentTransferEncoding]

Adds the content transfer encoding header to the response with the value

Adds the content transfer encoding header to the response with the value

Attributes

Adds the content type header to the response with the given value.

Adds the content type header to the response with the given value.

Attributes

def withContentType(value: CharSequence): Middleware[Any, Unit, Unit]

Adds the content type header to the response with the given value, if it is valid. Else, it adds an empty value.

Adds the content type header to the response with the given value, if it is valid. Else, it adds an empty value.

Attributes

def withContentTypeZIO[R, A](value: ZIO[R, Nothing, A])(implicit ev: A <:< ContentType): Middleware[R, Unit, ContentType]

Adds the content type header to the response with the value computed by the given effect.

Adds the content type header to the response with the value computed by the given effect.

Attributes

def withContentTypeZIO[R](value: ZIO[R, Nothing, CharSequence]): Middleware[R, Unit, ContentType]

Adds the content type header to the response with the value computed by the given effect, if it is valid. Else, it adds an empty value.

Adds the content type header to the response with the value computed by the given effect, if it is valid. Else, it adds an empty value.

Attributes

def withExpires(value: CharSequence): Middleware[Any, Unit, Unit]
def withIfRange(value: CharSequence): Middleware[Any, Unit, Unit]
def withProxyAuthenticate(value: CharSequence): Middleware[Any, Unit, Unit]
def withProxyAuthorization(value: CharSequence): Middleware[Any, Unit, Unit]
def withReferer(value: CharSequence): Middleware[Any, Unit, Unit]
def withRetryAfter(value: CharSequence): Middleware[Any, Unit, Unit]
def withTransferEncoding(value: CharSequence): Middleware[Any, Unit, Unit]

Concrete fields

val none: Middleware[Any, Unit, Unit]