| Safe Haskell | Safe-Inferred |
|---|---|
| Language | Haskell2010 |
Network.OAuth2.JWT
Description
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
Arguments
| :: Maybe NominalDiffTime | |
| -> UTCTime | current time |
| -> JWTClaimsSet | |
| -> Validation (NonEmpty JWTException) UTCTime |
exp
Arguments
| :: 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 Methods | |
| ToJSON UserSub Source # | |
Defined in Network.OAuth2.JWT | |
| ToJSONKey UserSub Source # | |
Defined in Network.OAuth2.JWT | |
| IsString UserSub Source # | |
Defined in Network.OAuth2.JWT Methods 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 Methods | |
| ToJSON UserEmail Source # | |
Defined in Network.OAuth2.JWT | |
| ToJSONKey UserEmail Source # | |
Defined in Network.OAuth2.JWT | |
| IsString UserEmail Source # | |
Defined in Network.OAuth2.JWT Methods fromString :: String -> UserEmail # | |
| Generic UserEmail Source # | |
| Show UserEmail Source # | |
| Eq UserEmail Source # | |
| Ord UserEmail Source # | |
| 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
Constructors
| JEMalformedJWT Text | |
| JEClaimNotFound String | |
| JEAudienceNotFound ApiAudience | |
| JEExpiredToken UTCTime | |
| JENotYetValid UTCTime | |
| JENoToken |