Trait/Object

akka.http.scaladsl.server.directives

SecurityDirectives

Related Docs: object SecurityDirectives | package directives

Permalink

trait SecurityDirectives extends AnyRef

Provides directives for securing an inner route using the standard Http authentication headers `WWW-Authenticate` and Authorization. Most prominently, HTTP Basic authentication and OAuth 2.0 Authorization Framework as defined in RFC 2617 and RFC 6750 respectively.

See: RFC 2617. See: RFC 6750.

Source
SecurityDirectives.scala
Linear Supertypes
AnyRef, Any
Known Subclasses
Type Hierarchy
Ordering
  1. Grouped
  2. Alphabetic
  3. By Inheritance
Inherited
  1. SecurityDirectives
  2. AnyRef
  3. Any
Implicitly
  1. by any2stringadd
  2. by StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Type Members

  1. type AsyncAuthenticator[T] = (Credentials) ⇒ Future[Option[T]]

    Permalink

  2. type AsyncAuthenticatorPF[T] = PartialFunction[Credentials, Future[T]]

    Permalink

  3. type AuthenticationResult[+T] = Either[HttpChallenge, T]

    Permalink

    The result of an HTTP authentication attempt is either the user object or an HttpChallenge to present to the browser.

  4. type Authenticator[T] = (Credentials) ⇒ Option[T]

    Permalink

  5. type AuthenticatorPF[T] = PartialFunction[Credentials, T]

    Permalink

Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  3. def +(other: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from SecurityDirectives to any2stringadd[SecurityDirectives] performed by method any2stringadd in scala.Predef.
    Definition Classes
    any2stringadd
  4. def ->[B](y: B): (SecurityDirectives, B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from SecurityDirectives to ArrowAssoc[SecurityDirectives] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  5. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  6. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  7. def authenticateBasic[T](realm: String, authenticator: Authenticator[T]): AuthenticationDirective[T]

    Permalink

    Wraps the inner route with Http Basic authentication support using a given Authenticator[T].

    Wraps the inner route with Http Basic authentication support using a given Authenticator[T]. The given authenticator determines whether the credentials in the request are valid and, if so, which user object to supply to the inner route.

  8. def authenticateBasicAsync[T](realm: String, authenticator: AsyncAuthenticator[T]): AuthenticationDirective[T]

    Permalink

    Wraps the inner route with Http Basic authentication support.

    Wraps the inner route with Http Basic authentication support. The given authenticator determines whether the credentials in the request are valid and, if so, which user object to supply to the inner route.

  9. def authenticateBasicPF[T](realm: String, authenticator: AuthenticatorPF[T]): AuthenticationDirective[T]

    Permalink

    A directive that wraps the inner route with Http Basic authentication support.

    A directive that wraps the inner route with Http Basic authentication support. The given authenticator determines whether the credentials in the request are valid and, if so, which user object to supply to the inner route.

  10. def authenticateBasicPFAsync[T](realm: String, authenticator: AsyncAuthenticatorPF[T]): AuthenticationDirective[T]

    Permalink

    A directive that wraps the inner route with Http Basic authentication support.

    A directive that wraps the inner route with Http Basic authentication support. The given authenticator determines whether the credentials in the request are valid and, if so, which user object to supply to the inner route.

  11. def authenticateOAuth2[T](realm: String, authenticator: Authenticator[T]): AuthenticationDirective[T]

    Permalink

    A directive that wraps the inner route with OAuth2 Bearer Token authentication support.

    A directive that wraps the inner route with OAuth2 Bearer Token authentication support. The given authenticator determines whether the credentials in the request are valid and, if so, which user object to supply to the inner route.

  12. def authenticateOAuth2Async[T](realm: String, authenticator: AsyncAuthenticator[T]): AuthenticationDirective[T]

    Permalink

    A directive that wraps the inner route with OAuth2 Bearer Token authentication support.

    A directive that wraps the inner route with OAuth2 Bearer Token authentication support. The given authenticator determines whether the credentials in the request are valid and, if so, which user object to supply to the inner route.

  13. def authenticateOAuth2PF[T](realm: String, authenticator: AuthenticatorPF[T]): AuthenticationDirective[T]

    Permalink

    A directive that wraps the inner route with OAuth2 Bearer Token authentication support.

    A directive that wraps the inner route with OAuth2 Bearer Token authentication support. The given authenticator determines whether the credentials in the request are valid and, if so, which user object to supply to the inner route.

  14. def authenticateOAuth2PFAsync[T](realm: String, authenticator: AsyncAuthenticatorPF[T]): AuthenticationDirective[T]

    Permalink

    A directive that wraps the inner route with OAuth2 Bearer Token authentication support.

    A directive that wraps the inner route with OAuth2 Bearer Token authentication support. The given authenticator determines whether the credentials in the request are valid and, if so, which user object to supply to the inner route.

  15. def authenticateOrRejectWithChallenge[C <: HttpCredentials, T](authenticator: (Option[C]) ⇒ Future[AuthenticationResult[T]])(implicit arg0: ClassTag[C]): AuthenticationDirective[T]

    Permalink

    Lifts an authenticator function into a directive.

    Lifts an authenticator function into a directive. Same as authenticateOrRejectWithChallenge but only applies the authenticator function with a certain type of credentials.

  16. def authenticateOrRejectWithChallenge[T](authenticator: (Option[HttpCredentials]) ⇒ Future[AuthenticationResult[T]]): AuthenticationDirective[T]

    Permalink

    Lifts an authenticator function into a directive.

    Lifts an authenticator function into a directive. The authenticator function gets passed in credentials from the Authorization header of the request. If the function returns Right(user) the user object is provided to the inner route. If the function returns Left(challenge) the request is rejected with an AuthenticationFailedRejection that contains this challenge to be added to the response.

  17. def authorize(check: (RequestContext) ⇒ Boolean): Directive0

    Permalink

    Applies the given authorization check to the request.

    Applies the given authorization check to the request. If the check fails the route is rejected with an AuthorizationFailedRejection.

  18. def authorize(check: ⇒ Boolean): Directive0

    Permalink

    Applies the given authorization check to the request.

    Applies the given authorization check to the request. If the check fails the route is rejected with an AuthorizationFailedRejection.

  19. def authorizeAsync(check: (RequestContext) ⇒ Future[Boolean]): Directive0

    Permalink

    Asynchronous version of authorize.

    Asynchronous version of authorize. If the Future fails or is completed with false authorization fails and the route is rejected with an AuthorizationFailedRejection.

  20. def authorizeAsync(check: ⇒ Future[Boolean]): Directive0

    Permalink

    Asynchronous version of authorize.

    Asynchronous version of authorize. If the Future fails or is completed with false authorization fails and the route is rejected with an AuthorizationFailedRejection.

  21. def clone(): AnyRef

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. def ensuring(cond: (SecurityDirectives) ⇒ Boolean, msg: ⇒ Any): SecurityDirectives

    Permalink
    Implicit information
    This member is added by an implicit conversion from SecurityDirectives to Ensuring[SecurityDirectives] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  23. def ensuring(cond: (SecurityDirectives) ⇒ Boolean): SecurityDirectives

    Permalink
    Implicit information
    This member is added by an implicit conversion from SecurityDirectives to Ensuring[SecurityDirectives] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  24. def ensuring(cond: Boolean, msg: ⇒ Any): SecurityDirectives

    Permalink
    Implicit information
    This member is added by an implicit conversion from SecurityDirectives to Ensuring[SecurityDirectives] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  25. def ensuring(cond: Boolean): SecurityDirectives

    Permalink
    Implicit information
    This member is added by an implicit conversion from SecurityDirectives to Ensuring[SecurityDirectives] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  26. final def eq(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  27. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    AnyRef → Any
  28. def extractCredentials: Directive1[Option[HttpCredentials]]

    Permalink

    Extracts the potentially present HttpCredentials provided with the request's Authorization header.

  29. def finalize(): Unit

    Permalink
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  30. def formatted(fmtstr: String): String

    Permalink
    Implicit information
    This member is added by an implicit conversion from SecurityDirectives to StringFormat[SecurityDirectives] performed by method StringFormat in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  31. final def getClass(): Class[_]

    Permalink
    Definition Classes
    AnyRef → Any
  32. def hashCode(): Int

    Permalink
    Definition Classes
    AnyRef → Any
  33. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  34. final def ne(arg0: AnyRef): Boolean

    Permalink
    Definition Classes
    AnyRef
  35. final def notify(): Unit

    Permalink
    Definition Classes
    AnyRef
  36. final def notifyAll(): Unit

    Permalink
    Definition Classes
    AnyRef
  37. final def synchronized[T0](arg0: ⇒ T0): T0

    Permalink
    Definition Classes
    AnyRef
  38. def toString(): String

    Permalink
    Definition Classes
    AnyRef → Any
  39. final def wait(): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  40. final def wait(arg0: Long, arg1: Int): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  41. final def wait(arg0: Long): Unit

    Permalink
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  42. def [B](y: B): (SecurityDirectives, B)

    Permalink
    Implicit information
    This member is added by an implicit conversion from SecurityDirectives to ArrowAssoc[SecurityDirectives] performed by method ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from SecurityDirectives to any2stringadd[SecurityDirectives]

Inherited by implicit conversion StringFormat from SecurityDirectives to StringFormat[SecurityDirectives]

Inherited by implicit conversion Ensuring from SecurityDirectives to Ensuring[SecurityDirectives]

Inherited by implicit conversion ArrowAssoc from SecurityDirectives to ArrowAssoc[SecurityDirectives]

Security directives

Ungrouped