Safe Haskell | Safe-Inferred |
---|---|
Language | GHC2021 |
Synopsis
- data AuthedUser = AuthedUser {
- authedToken :: !Text
- authedUserID :: !UserID
- withAuth :: (MonadIO m, MonadReader c m, Has JWTInfo c m) => (AuthedUser -> ActionT m ()) -> ActionT m ()
- maybeWithAuth :: (MonadIO m, Has JWTInfo c m) => (Maybe AuthedUser -> ActionT m ()) -> ActionT m ()
- class Monad m => AuthTokenGen m where
- mkAuthToken :: UserID -> m Text
- makeAuthTokenPure :: JWTInfo -> POSIXTime -> UserID -> Text
- tryMakeAuthedUser :: ToText a => JWTInfo -> POSIXTime -> a -> Maybe AuthedUser
- tryGetSubjectFromJWT :: JWTInfo -> POSIXTime -> Text -> Maybe UserID
- tryGetClaims :: JWTInfo -> Text -> Maybe JWTClaimsSet
- extractToken :: Text -> Maybe Text
- authErrRes :: Map Text Text
Documentation
data AuthedUser Source #
The form of an authenticated user passed into any endpoint using withAuth
/maybeWithAuth
.
AuthedUser | |
|
Instances
Show AuthedUser Source # | |
Defined in Conduit.Identity.Auth showsPrec :: Int -> AuthedUser -> ShowS # show :: AuthedUser -> String # showList :: [AuthedUser] -> ShowS # | |
Eq AuthedUser Source # | |
Defined in Conduit.Identity.Auth (==) :: AuthedUser -> AuthedUser -> Bool # (/=) :: AuthedUser -> AuthedUser -> Bool # |
withAuth :: (MonadIO m, MonadReader c m, Has JWTInfo c m) => (AuthedUser -> ActionT m ()) -> ActionT m () Source #
An endpoint which requires user authentication.
endpoint = get "/" $ withAuth \(user :: AuthedUser) -> do ...
maybeWithAuth :: (MonadIO m, Has JWTInfo c m) => (Maybe AuthedUser -> ActionT m ()) -> ActionT m () Source #
An endpoint which requests, but does require, user authentication.
endpoint = get "/" $ maybeWithAuth \(user :: Maybe AuthedUser) -> do ...
class Monad m => AuthTokenGen m where Source #
Some monad which can generate a JWT
mkAuthToken :: UserID -> m Text Source #
Instances
(Monad m, MonadIO m, Has JWTInfo c m) => AuthTokenGen m Source # | |
Defined in Conduit.Identity.Auth mkAuthToken :: UserID -> m Text Source # |
tryMakeAuthedUser :: ToText a => JWTInfo -> POSIXTime -> a -> Maybe AuthedUser Source #
tryGetClaims :: JWTInfo -> Text -> Maybe JWTClaimsSet Source #