com.github.kikuomax.spray.jwt

JwtDirectives

trait JwtDirectives extends AnyRef

Provides utilities for signing and verification by the JSON Web Token (JWT).

Linear Supertypes
AnyRef, Any
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. JwtDirectives
  2. AnyRef
  3. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

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. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  5. def authorizeToken[T](magnet: JwtAuthorizationMagnet[T]): Directive1[T]

    Verifies a token sent with an HTTP request.

    Verifies a token sent with an HTTP request.

    A token should be sent through the Authorization header like,

    Authorization: Bearer JWT

    Thanks to JwtAuthorizationMagnet, this directive will end up the following form,

    authorizeToken[T](privilege: JWTClaimsSet => Option[T])
      (implicit verifier: JWSObject => Option[JWTClaimsSet]): Directive1[T]

    And will

    1. Obtain the value associated with "Authorization" header.
    2. Extract a JWT from the "Authorization" header value.
    3. Verify the JWT with verifier and extract a claim set.
    4. Apply privilege to the claim set.
    5. Supply the result from privilege to the inner route.

    Will reject,

    • if no "Authorization" header is specified,
    • or if the "Authorization" header does not specify a JWT,
    • or if verifier cannot verify the JWT,
    • or if privilege rejects the claims set.
  6. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. final def eq(arg0: AnyRef): Boolean

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

    Definition Classes
    AnyRef → Any
  9. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  10. final def getClass(): Class[_]

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

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

    Definition Classes
    Any
  13. def jwtAuthenticator[T](authenticator: UserPassAuthenticator[T])(implicit claimBuilder: (T) ⇒ Option[JWTClaimsSet], signer: (JWTClaimsSet) ⇒ JWSObject, executionContext: ExecutionContext): UserPassAuthenticator[JWSObject]

    A UserPassAuthenticator which returns a JWS object if a given pair of a user and a password is authenticated.

    A UserPassAuthenticator which returns a JWS object if a given pair of a user and a password is authenticated.

    Useful if combined with BasicAuth and an authenticate directive. An inner route of an authenticate directive will receive a JWS object (JWSObject) built by claimBuilder and signed by signer.

    authenticator

    The UserPassAuthenticator which authenticates a given pair of a user and a password.

    claimBuilder

    Builds a claim set from a result of authenticator.

    signer

    Signs a result of claimBuilder.

    executionContext

    The execution context to run a Future returned from authenticator.

  14. final def ne(arg0: AnyRef): Boolean

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

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

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

    Definition Classes
    AnyRef
  18. def toString(): String

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

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped