akka.http.scaladsl.server.directives

SecurityDirectives

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 as defined in RFC 2617.

Source
SecurityDirectives.scala
Linear Supertypes
Known Subclasses
Type Hierarchy Learn more about scaladoc diagrams
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. SecurityDirectives
  2. AnyRef
  3. Any
Implicitly
  1. by any2stringadd
  2. by any2stringfmt
  3. by any2ArrowAssoc
  4. by any2Ensuring
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

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

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

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

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

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

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

Value Members

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

    Definition Classes
    AnyRef
  2. final def !=(arg0: Any): Boolean

    Definition Classes
    Any
  3. final def ##(): Int

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

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

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

    Definition Classes
    AnyRef
  7. final def ==(arg0: Any): Boolean

    Definition Classes
    Any
  8. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  9. def authenticateBasic[T](realm: String, authenticator: (UserCredentials) ⇒ Option[T]): AuthenticationDirective[T]

    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.

  10. def authenticateBasicAsync[T](realm: String, authenticator: (UserCredentials) ⇒ Future[Option[T]]): AuthenticationDirective[T]

    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.

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

    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.

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

    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.

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

    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.

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

    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.

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

    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.

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

    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.

  17. def challengeFor(realm: String): HttpChallenge

    Creates a Basic HttpChallenge for the given realm.

  18. def clone(): AnyRef

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

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

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

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

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

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

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

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

  26. def finalize(): Unit

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

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

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

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

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

    Definition Classes
    AnyRef
  32. final def notify(): Unit

    Definition Classes
    AnyRef
  33. final def notifyAll(): Unit

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

    Definition Classes
    AnyRef
  35. def toString(): String

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

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

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

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

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

Shadowed Implicit Value Members

  1. val self: Any

    Implicit information
    This member is added by an implicit conversion from SecurityDirectives to StringAdd performed by method any2stringadd in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (securityDirectives: StringAdd).self
    Definition Classes
    StringAdd
  2. val self: Any

    Implicit information
    This member is added by an implicit conversion from SecurityDirectives to StringFormat performed by method any2stringfmt in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (securityDirectives: StringFormat).self
    Definition Classes
    StringFormat

Deprecated Value Members

  1. def x: SecurityDirectives

    Implicit information
    This member is added by an implicit conversion from SecurityDirectives to ArrowAssoc[SecurityDirectives] performed by method any2ArrowAssoc in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (securityDirectives: ArrowAssoc[SecurityDirectives]).x
    Definition Classes
    ArrowAssoc
    Annotations
    @deprecated
    Deprecated

    (Since version 2.10.0) Use leftOfArrow instead

  2. def x: SecurityDirectives

    Implicit information
    This member is added by an implicit conversion from SecurityDirectives to Ensuring[SecurityDirectives] performed by method any2Ensuring in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (securityDirectives: Ensuring[SecurityDirectives]).x
    Definition Classes
    Ensuring
    Annotations
    @deprecated
    Deprecated

    (Since version 2.10.0) Use resultOfEnsuring instead

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from SecurityDirectives to StringAdd

Inherited by implicit conversion any2stringfmt from SecurityDirectives to StringFormat

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

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

Ungrouped