icepeak-0.7.2.0: A fast JSON document store with push notification support.

Safe HaskellNone
LanguageHaskell2010

JwtAuth

Contents

Description

This module contains all the web framework independent code for parsing and verifying JSON Web Tokens.

Synopsis

Token verification

verifyToken :: POSIXTime -> Signer -> ByteString -> Either VerificationError (JWT VerifiedJWT) Source #

Check that a token is valid at the given time for the given secret.

verifyNotBefore :: POSIXTime -> JWT VerifiedJWT -> Either VerificationError (JWT VerifiedJWT) Source #

Verify that the token is not used before it was issued.

verifyExpiry :: POSIXTime -> JWT VerifiedJWT -> Either VerificationError (JWT VerifiedJWT) Source #

Verify that the token is not used after is has expired.

verifySignature :: Signer -> JWT UnverifiedJWT -> Either VerificationError (JWT VerifiedJWT) Source #

Verify that the token contains a valid signature.

Claim parsing

data TokenError Source #

Constructors

VerificationError VerificationError

JWT could not be verified.

ClaimError String

The claims do not fit the schema.

Instances
Eq TokenError Source # 
Instance details

Defined in JwtAuth

Show TokenError Source # 
Instance details

Defined in JwtAuth

extractClaim :: POSIXTime -> Signer -> ByteString -> Either TokenError IcepeakClaim Source #

Verify the token and extract the icepeak claim from it.

extractClaimUnverified :: ByteString -> Either TokenError IcepeakClaim Source #

Extract the icepeak claim from the token without verifying it.

Token generation

addIcepeakClaim :: IcepeakClaim -> JWTClaimsSet -> JWTClaimsSet Source #

Add the icepeak claim to a set of JWT claims.