Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module contains all the web framework independent code for parsing and verifying JSON Web Tokens.
Synopsis
- data VerificationError
- verifyToken :: POSIXTime -> Signer -> ByteString -> Either VerificationError (JWT VerifiedJWT)
- verifyNotBefore :: POSIXTime -> JWT VerifiedJWT -> Either VerificationError (JWT VerifiedJWT)
- verifyExpiry :: POSIXTime -> JWT VerifiedJWT -> Either VerificationError (JWT VerifiedJWT)
- verifySignature :: Signer -> JWT UnverifiedJWT -> Either VerificationError (JWT VerifiedJWT)
- decodeToken :: ByteString -> Either VerificationError (JWT UnverifiedJWT)
- data TokenError
- extractClaim :: POSIXTime -> Signer -> ByteString -> Either TokenError IcepeakClaim
- extractClaimUnverified :: ByteString -> Either TokenError IcepeakClaim
- getIcepeakClaim :: JWT r -> Either String IcepeakClaim
- addIcepeakClaim :: IcepeakClaim -> JWTClaimsSet -> JWTClaimsSet
Token verification
data VerificationError Source #
Instances
Eq VerificationError Source # | |
Defined in JwtAuth (==) :: VerificationError -> VerificationError -> Bool # (/=) :: VerificationError -> VerificationError -> Bool # | |
Show VerificationError Source # | |
Defined in JwtAuth showsPrec :: Int -> VerificationError -> ShowS # show :: VerificationError -> String # showList :: [VerificationError] -> ShowS # |
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 #
VerificationError VerificationError | JWT could not be verified. |
ClaimError String | The claims do not fit the schema. |
Instances
Eq TokenError Source # | |
Defined in JwtAuth (==) :: TokenError -> TokenError -> Bool # (/=) :: TokenError -> TokenError -> Bool # | |
Show TokenError Source # | |
Defined in JwtAuth showsPrec :: Int -> TokenError -> ShowS # show :: TokenError -> String # showList :: [TokenError] -> ShowS # |
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.
getIcepeakClaim :: JWT r -> Either String IcepeakClaim Source #
Token generation
addIcepeakClaim :: IcepeakClaim -> JWTClaimsSet -> JWTClaimsSet Source #
Add the icepeak claim to a set of JWT claims.