object Middleware

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Middleware
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Type Members

  1. sealed trait Control[+State] extends AnyRef
  2. final class Interceptor1[S] extends AnyVal
  3. class Interceptor2[S, R, I, O] extends AnyRef

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. def addCookie(cookie: Cookie[Response]): Middleware[Any, Unit, Cookie[Response]]

    Sets cookie in response headers

  5. def addCookieZIO[R](cookie: ZIO[R, Nothing, Cookie[Response]]): Middleware[R, Unit, Cookie[Response]]
  6. def addHeader(header: Header): Middleware[Any, Unit, Unit]
  7. def addHeaders(headers: Headers): Middleware[Any, Unit, Unit]
  8. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  9. 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

  10. final def basicAuth(f: (Credentials) => Boolean)(implicit trace: Trace): Middleware[Any, Authorization, Unit]

    Creates a middleware for basic authentication

  11. 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

  12. 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

  13. 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

  14. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native() @HotSpotIntrinsicCandidate()
  15. 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

  16. 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

  17. 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

  18. 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.

  19. 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.

  20. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  21. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  22. def fromFunction[A, B](spec: MiddlewareSpec[A, B])(f: (A) => B): Middleware[Any, A, B]
  23. def fromFunctionZIO[R, A, B](spec: MiddlewareSpec[A, B])(f: (A) => ZIO[R, Nothing, B]): Middleware[R, A, B]
  24. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  25. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  26. def intercept[S, R, I, O](spec: MiddlewareSpec[I, O])(incoming: (I) => Control[S])(outgoing: (S, Response) => O): Middleware[R, I, O]
  27. def interceptZIO[S]: Interceptor1[S]
  28. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  29. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  30. val none: Middleware[Any, Unit, Unit]
  31. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  32. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native() @HotSpotIntrinsicCandidate()
  33. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  34. def toString(): String
    Definition Classes
    AnyRef → Any
  35. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  36. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  37. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  38. def withAccept(value: CharSequence): Middleware[Any, Unit, Accept]
  39. def withAcceptEncoding(value: CharSequence): Middleware[Any, Unit, AcceptEncoding]
  40. def withAcceptLanguage(value: CharSequence): Middleware[Any, Unit, AcceptLanguage]
  41. def withAcceptPatch(value: CharSequence): Middleware[Any, Unit, AcceptPatch]
  42. def withAcceptRanges(value: CharSequence): Middleware[Any, Unit, AcceptRanges]
  43. def withAccessControlAllowCredentials(value: Boolean): Middleware[Any, Unit, Unit]
  44. def withAccessControlAllowMaxAge(value: CharSequence): Middleware[Any, Unit, Unit]
  45. def withAccessControlAllowMethods(value: CharSequence): Middleware[Any, Unit, Unit]
  46. def withAccessControlAllowMethods(value: Method*): Middleware[Any, Unit, Unit]
  47. def withAccessControlAllowOrigin(value: CharSequence): Middleware[Any, Unit, Unit]
  48. def withConnection(value: CharSequence): Middleware[Any, Unit, Unit]
  49. 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.

  50. def withContentBase(value: ContentBase): Middleware[Any, Unit, Unit]

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

  51. 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.

  52. 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.

  53. 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.

  54. def withContentDisposition(value: ContentDisposition): Middleware[Any, Unit, Unit]

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

  55. 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.

  56. 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.

  57. 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.

  58. def withContentEncoding(value: ContentEncoding): Middleware[Any, Unit, Unit]

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

  59. 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.

  60. 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.

  61. 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.

  62. def withContentLanguage(value: ContentLanguage): Middleware[Any, Unit, Unit]

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

  63. 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.

  64. 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.

  65. 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.

  66. def withContentLength(value: ContentLength): Middleware[Any, Unit, Unit]

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

  67. 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.

  68. 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.

  69. 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.

  70. def withContentLocation(value: ContentLocation): Middleware[Any, Unit, Unit]

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

  71. 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.

  72. 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.

  73. 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.

  74. def withContentMd5(value: ContentMd5): Middleware[Any, Unit, Unit]

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

  75. 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.

  76. 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.

  77. 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.

  78. def withContentRange(value: ContentRange): Middleware[Any, Unit, Unit]

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

  79. 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.

  80. 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.

  81. 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.

  82. def withContentSecurityPolicy(value: ContentSecurityPolicy): Middleware[Any, Unit, Unit]

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

  83. 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.

  84. 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.

  85. 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.

  86. def withContentTransferEncoding(value: ContentTransferEncoding): Middleware[Any, Unit, Unit]

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

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

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

  88. 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

  89. 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.

  90. def withContentType(value: ContentType): Middleware[Any, Unit, Unit]

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

  91. 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.

  92. 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.

  93. def withExpires(value: CharSequence): Middleware[Any, Unit, Unit]
  94. def withIfRange(value: CharSequence): Middleware[Any, Unit, Unit]
  95. def withProxyAuthenticate(value: CharSequence): Middleware[Any, Unit, Unit]
  96. def withProxyAuthorization(value: CharSequence): Middleware[Any, Unit, Unit]
  97. def withReferer(value: CharSequence): Middleware[Any, Unit, Unit]
  98. def withRetryAfter(value: CharSequence): Middleware[Any, Unit, Unit]
  99. def withTransferEncoding(value: CharSequence): Middleware[Any, Unit, Unit]
  100. object Control

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

Inherited from AnyRef

Inherited from Any

Ungrouped