object Middleware
- Alphabetic
- By Inheritance
- Middleware
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
- sealed trait Control[+State] extends AnyRef
- final class Interceptor1[S] extends AnyVal
- class Interceptor2[S, R, I, O] extends AnyRef
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def addCookie(cookie: Cookie[Response]): Middleware[Any, Unit, Cookie[Response]]
Sets cookie in response headers
- 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 asInstanceOf[T0]: T0
- Definition Classes
- Any
- 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
- final def basicAuth(f: (Credentials) => Boolean)(implicit trace: Trace): Middleware[Any, Authorization, Unit]
Creates a middleware for basic authentication
- 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
- 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
- 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
- f
: function that effectfully validates the token string inside the Bearer Header
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
- def cors(config: CorsConfig = CorsConfig()): Middleware[Any, (Method, Option[Origin], Option[AccessControlRequestMethod]), Unit]
Creates a middleware for Cross-Origin Resource Sharing (CORS).
Creates a middleware for Cross-Origin Resource Sharing (CORS).
- See also
https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS
- final def csrfGenerate[R, E](tokenName: String = "x-csrf-token", tokenGen: ZIO[R, Nothing, String] = ZIO.succeed(UUID.randomUUID.toString)(Trace.empty))(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
- def csrfValidate(tokenName: String = "x-csrf-token"): Middleware[Any, CsrfValidate, Unit]
Validates the CSRF token appearing in the request headers.
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
- 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.
- def customAuthZIO[R, I](headerCodec: HeaderCodec[I], responseHeaders: Headers = Headers.empty, responseStatus: Status = Status.Unauthorized)(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.
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- 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]
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- def intercept[S, R, I, O](spec: MiddlewareSpec[I, O])(incoming: (I) => Control[S])(outgoing: (S, Response) => O): Middleware[R, I, O]
- def interceptZIO[S]: Interceptor1[S]
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- val none: Middleware[Any, Unit, Unit]
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @HotSpotIntrinsicCandidate()
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- 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 withAccessControlAllowCredentials(value: Boolean): Middleware[Any, Unit, Unit]
- def withAccessControlAllowMaxAge(value: CharSequence): Middleware[Any, Unit, Unit]
- def withAccessControlAllowMethods(value: CharSequence): Middleware[Any, Unit, Unit]
- def withAccessControlAllowMethods(value: Method*): Middleware[Any, Unit, Unit]
- def withAccessControlAllowOrigin(value: CharSequence): Middleware[Any, Unit, Unit]
- def withConnection(value: CharSequence): Middleware[Any, Unit, Unit]
- def withContentBase(value: CharSequence): Middleware[Any, Unit, Unit]
Adds the content base header to the response with the given value, if it is valid.
Adds the content base header to the response with the given value, if it is valid. Else, it add an empty value.
- def withContentBase(value: ContentBase): Middleware[Any, Unit, Unit]
Adds the content base header to the response with the given value.
- 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.
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.
- 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.
- def withContentDisposition(value: CharSequence): Middleware[Any, Unit, Unit]
Adds the content disposition header to the response with the given value, if it is valid.
Adds the content disposition header to the response with the given value, if it is valid. Else, it adds an empty value.
- def withContentDisposition(value: ContentDisposition): Middleware[Any, Unit, Unit]
Adds the content disposition header to the response with the given value.
- 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.
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.
- 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.
- def withContentEncoding(value: CharSequence): Middleware[Any, Unit, Unit]
Adds the content encoding header to the response with the given value, if it is valid.
Adds the content encoding header to the response with the given value, if it is valid. Else, it adds an empty value.
- def withContentEncoding(value: ContentEncoding): Middleware[Any, Unit, Unit]
Adds the content encoding header to the response with the given value.
- 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.
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.
- 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.
- def withContentLanguage(value: CharSequence): Middleware[Any, Unit, Unit]
Adds the content language header to the response with the given value, if it is valid.
Adds the content language header to the response with the given value, if it is valid. Else, it adds an empty value.
- def withContentLanguage(value: ContentLanguage): Middleware[Any, Unit, Unit]
Adds the content language header to the response with the given value.
- 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.
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.
- 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.
- def withContentLength(value: Long): Middleware[Any, Unit, Unit]
Adds the content length header to the response with the given value, if it is valid.
Adds the content length header to the response with the given value, if it is valid. Else, it adds an empty value.
- def withContentLength(value: ContentLength): Middleware[Any, Unit, Unit]
Adds the content length header to the response with the given value.
- 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.
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.
- 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.
- def withContentLocation(value: CharSequence): Middleware[Any, Unit, Unit]
Adds the content location header to the response with the given value, if it is valid.
Adds the content location header to the response with the given value, if it is valid. Else, it adds an empty value.
- def withContentLocation(value: ContentLocation): Middleware[Any, Unit, Unit]
Adds the content location header to the response with the given value.
- 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.
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.
- 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.
- def withContentMd5(value: CharSequence): Middleware[Any, Unit, Unit]
Adds the content md5 header to the response with the given value, if it is valid.
Adds the content md5 header to the response with the given value, if it is valid. Else, it adds an empty value.
- def withContentMd5(value: ContentMd5): Middleware[Any, Unit, Unit]
Adds the content md5 header to the response with the given value.
- 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.
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.
- 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.
- def withContentRange(value: CharSequence): Middleware[Any, Unit, Unit]
Adds the content range header to the response with the given value, if it is valid.
Adds the content range header to the response with the given value, if it is valid. Else, it adds an empty value.
- def withContentRange(value: ContentRange): Middleware[Any, Unit, Unit]
Adds the content range header to the response with the given value.
- 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.
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.
- 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.
- 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.
Adds the content security policy header to the response with the given value, if it is valid. Else, it adds an empty value.
- def withContentSecurityPolicy(value: ContentSecurityPolicy): Middleware[Any, Unit, Unit]
Adds the content security policy header to the response with the given value.
- 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.
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.
- 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.
- 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.
Adds the content transfer encoding header to the response with the given value, if it is valid. Else, it adds an empty value.
- def withContentTransferEncoding(value: ContentTransferEncoding): Middleware[Any, Unit, Unit]
Adds the content transfer encoding header to the response with the given value.
- def withContentTransferEncodingZIO[R](value: ZIO[R, Nothing, CharSequence]): Middleware[R, Unit, ContentTransferEncoding]
Adds the content transfer encoding header to the response with the value
- def withContentTransferEncodingZIO[R, A](value: ZIO[R, Nothing, A])(implicit ev: <:<[A, ContentTransferEncoding]): Middleware[R, Unit, ContentTransferEncoding]
Adds the content transfer encoding header to the response with the value
- def withContentType(value: CharSequence): Middleware[Any, Unit, Unit]
Adds the content type header to the response with the given value, if it is valid.
Adds the content type header to the response with the given value, if it is valid. Else, it adds an empty value.
- def withContentType(value: ContentType): Middleware[Any, Unit, Unit]
Adds the content type header to the response with the given value.
- 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.
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.
- 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.
- 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]
- object Control