realworld-hs-0.1.0.0: Scotty impl of https://github.com/gothinkster/realworld
Safe HaskellSafe-Inferred
LanguageGHC2021

Conduit.Identity.Auth

Synopsis

Documentation

data AuthedUser Source #

The form of an authenticated user passed into any endpoint using withAuth/maybeWithAuth.

Constructors

AuthedUser 

Instances

Instances details
Show AuthedUser Source # 
Instance details

Defined in Conduit.Identity.Auth

Eq AuthedUser Source # 
Instance details

Defined in Conduit.Identity.Auth

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

Methods

mkAuthToken :: UserID -> m Text Source #

Instances

Instances details
(Monad m, MonadIO m, Has JWTInfo c m) => AuthTokenGen m Source # 
Instance details

Defined in Conduit.Identity.Auth

Methods

mkAuthToken :: UserID -> m Text Source #