Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Decode and validate a JWT token
provides Validation
function for the individual fields as well
Synopsis
- jwtClaims :: Text -> Maybe JWTClaimsSet
- decValidSub :: JWTClaimsSet -> Validation (NonEmpty JWTException) UserSub
- decValidExp :: Maybe NominalDiffTime -> UTCTime -> JWTClaimsSet -> Validation (NonEmpty JWTException) UTCTime
- decValidNbf :: UTCTime -> JWTClaimsSet -> Validation (NonEmpty JWTException) UTCTime
- decValidEmail :: JWTClaimsSet -> Validation (NonEmpty JWTException) UserEmail
- decValidAud :: ApiAudience -> JWTClaimsSet -> Validation (NonEmpty JWTException) Text
- data UserSub
- userSub :: UserSub -> Text
- data UserEmail
- userEmail :: UserEmail -> Text
- data ApiAudience
- apiAudience :: ApiAudience -> Text
- data JWTException
1) Decode a string into claims
jwtClaims :: Text -> Maybe JWTClaimsSet Source #
Decode a string into a JWTClaimsSet
2) Extract and validate the individual claims
decValidSub :: JWTClaimsSet -> Validation (NonEmpty JWTException) UserSub Source #
sub
:: Maybe NominalDiffTime | |
-> UTCTime | current time |
-> JWTClaimsSet | |
-> Validation (NonEmpty JWTException) UTCTime |
exp
:: UTCTime | current time |
-> JWTClaimsSet | |
-> Validation (NonEmpty JWTException) UTCTime |
nbf
decValidEmail :: JWTClaimsSet -> Validation (NonEmpty JWTException) UserEmail Source #
decValidAud :: ApiAudience -> JWTClaimsSet -> Validation (NonEmpty JWTException) Text Source #
aud
sub
field
Instances
FromJSON UserSub Source # | |
FromJSONKey UserSub Source # | |
Defined in Network.OAuth2.JWT | |
ToJSON UserSub Source # | |
Defined in Network.OAuth2.JWT | |
ToJSONKey UserSub Source # | |
Defined in Network.OAuth2.JWT | |
IsString UserSub Source # | |
Defined in Network.OAuth2.JWT fromString :: String -> UserSub # | |
Generic UserSub Source # | |
Show UserSub Source # | |
Eq UserSub Source # | |
Ord UserSub Source # | |
type Rep UserSub Source # | |
Defined in Network.OAuth2.JWT |
Instances
FromJSON UserEmail Source # | |
FromJSONKey UserEmail Source # | |
Defined in Network.OAuth2.JWT | |
ToJSON UserEmail Source # | |
Defined in Network.OAuth2.JWT | |
ToJSONKey UserEmail Source # | |
Defined in Network.OAuth2.JWT | |
IsString UserEmail Source # | |
Defined in Network.OAuth2.JWT fromString :: String -> UserEmail # | |
Generic UserEmail Source # | |
Show UserEmail Source # | |
Eq UserEmail Source # | |
Ord UserEmail Source # | |
Defined in Network.OAuth2.JWT | |
type Rep UserEmail Source # | |
Defined in Network.OAuth2.JWT |
data ApiAudience Source #
intended audience of the token (== API key ID )
Instances
apiAudience :: ApiAudience -> Text Source #
data JWTException Source #
Possible exception states of authentication request
JEMalformedJWT Text | |
JEClaimNotFound String | |
JEAudienceNotFound ApiAudience | |
JEExpiredToken UTCTime | |
JENotYetValid UTCTime | |
JENoToken |