License | AGPL-3.0-or-later |
---|---|
Maintainer | monawasensei@gmail.com |
Safe Haskell | None |
Language | GHC2024 |
Monax.Auth.Servant
Description
Synopsis
- data SessionRequired
- class CoalesceSessionRequired (r :: SessionRequired) where
- type CoalesceSessionRequiredRep (r :: SessionRequired) a
- coalesceSessionRequired :: Proxy r -> CoalesceSessionRequiredRep r a -> Maybe a
- data family SessionCookie :: k -> SessionRequired -> Type -> Type
- newtype SessionID = SessionID UUID
- newSessionID :: IO SessionID
- newtype AuthenticationRedirectURL = AuthenticationRedirectURL Text
- data BasicAuthReqBody = BasicAuthReqBody {
- barbUsername :: Text
- barbPassword :: Text
- makeSetSessionCookie :: AddHeader '[Optional, Strict] "Set-Cookie" Text orig new => Cipher -> SessionID -> Integer -> Text -> IO (orig -> new)
Documentation
data SessionRequired Source #
Marks an endpoint as requiring a valid session to proceed.
Constructors
NotRequired | |
Required |
Instances
class CoalesceSessionRequired (r :: SessionRequired) where Source #
Polymorphically converting SessionRequired
dependent values to
their weakest common form, NotRequired
.
coalesceSessionRequired (Proxy @Required) :: a -> Maybe a
coalesceSessionRequired (Proxy @NotRequired) :: Maybe a -> Maybe a
Associated Types
type CoalesceSessionRequiredRep (r :: SessionRequired) a Source #
Methods
coalesceSessionRequired :: Proxy r -> CoalesceSessionRequiredRep r a -> Maybe a Source #
Coalesce a SessionRequired
dependent value to an optional form.
Instances
CoalesceSessionRequired 'NotRequired Source # | |||||
Defined in Monax.Auth.Servant Associated Types
Methods coalesceSessionRequired :: Proxy 'NotRequired -> CoalesceSessionRequiredRep 'NotRequired a -> Maybe a Source # | |||||
CoalesceSessionRequired 'Required Source # | |||||
Defined in Monax.Auth.Servant Associated Types
Methods coalesceSessionRequired :: Proxy 'Required -> CoalesceSessionRequiredRep 'Required a -> Maybe a Source # |
data family SessionCookie :: k -> SessionRequired -> Type -> Type Source #
Reads a session token from the request cookies, and depending on
the SessionRequired
value, will proceed with an optional or required
value for the user's session state.
Instances
HasLink api => HasLink (SessionCookie i r b :> api :: Type) Source # | |
Defined in Monax.Auth.Servant Methods toLink :: (Link -> a) -> Proxy (SessionCookie i r b :> api) -> Link -> MkLink (SessionCookie i r b :> api) a # | |
(HasContextEntry context (Tagged i (Sessions SessionID a)), HasContextEntry context Cipher, HasServer api context) => HasServer (SessionCookie i 'NotRequired a :> api :: Type) context Source # | |
Defined in Monax.Auth.Servant Methods route :: Proxy (SessionCookie i 'NotRequired a :> api) -> Context context -> Delayed env (Server (SessionCookie i 'NotRequired a :> api)) -> Router env # hoistServerWithContext :: Proxy (SessionCookie i 'NotRequired a :> api) -> Proxy context -> (forall x. m x -> n x) -> ServerT (SessionCookie i 'NotRequired a :> api) m -> ServerT (SessionCookie i 'NotRequired a :> api) n # | |
(HasContextEntry context (Tagged i (Sessions SessionID a)), HasContextEntry context Cipher, HasContextEntry context AuthenticationRedirectURL, HasServer api context) => HasServer (SessionCookie i 'Required a :> api :: Type) context Source # | |
Defined in Monax.Auth.Servant Methods route :: Proxy (SessionCookie i 'Required a :> api) -> Context context -> Delayed env (Server (SessionCookie i 'Required a :> api)) -> Router env # hoistServerWithContext :: Proxy (SessionCookie i 'Required a :> api) -> Proxy context -> (forall x. m x -> n x) -> ServerT (SessionCookie i 'Required a :> api) m -> ServerT (SessionCookie i 'Required a :> api) n # | |
type IsElem' e (SessionCookie i r b :> api) Source # | |
Defined in Monax.Auth.Servant | |
type MkLink (SessionCookie i r b :> api :: Type) a Source # | |
Defined in Monax.Auth.Servant | |
type ServerT (SessionCookie i 'NotRequired a :> api :: Type) m Source # | |
Defined in Monax.Auth.Servant type ServerT (SessionCookie i 'NotRequired a :> api :: Type) m = Maybe (SessionID, a) -> ServerT api m | |
type ServerT (SessionCookie i 'Required a :> api :: Type) m Source # | |
Defined in Monax.Auth.Servant |
Unique identifier suitable for sessions.
newtype AuthenticationRedirectURL Source #
A link to somewhere a user can authenticate and be issued a session token.
Constructors
AuthenticationRedirectURL Text |
Instances
Monoid AuthenticationRedirectURL Source # | |||||
Defined in Monax.Auth.Servant | |||||
Semigroup AuthenticationRedirectURL Source # | |||||
Defined in Monax.Auth.Servant | |||||
IsString AuthenticationRedirectURL Source # | |||||
Defined in Monax.Auth.Servant Methods | |||||
Generic AuthenticationRedirectURL Source # | |||||
Defined in Monax.Auth.Servant Associated Types
Methods from :: AuthenticationRedirectURL -> Rep AuthenticationRedirectURL x # to :: Rep AuthenticationRedirectURL x -> AuthenticationRedirectURL # | |||||
Show AuthenticationRedirectURL Source # | |||||
Defined in Monax.Auth.Servant Methods showsPrec :: Int -> AuthenticationRedirectURL -> ShowS # show :: AuthenticationRedirectURL -> String # showList :: [AuthenticationRedirectURL] -> ShowS # | |||||
Eq AuthenticationRedirectURL Source # | |||||
Defined in Monax.Auth.Servant Methods (==) :: AuthenticationRedirectURL -> AuthenticationRedirectURL -> Bool # (/=) :: AuthenticationRedirectURL -> AuthenticationRedirectURL -> Bool # | |||||
type Rep AuthenticationRedirectURL Source # | |||||
Defined in Monax.Auth.Servant type Rep AuthenticationRedirectURL = D1 ('MetaData "AuthenticationRedirectURL" "Monax.Auth.Servant" "monax-auth-api-0.3.0.0-inplace" 'True) (C1 ('MetaCons "AuthenticationRedirectURL" 'PrefixI 'False) (S1 ('MetaSel ('Nothing :: Maybe Symbol) 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 Text))) |
data BasicAuthReqBody Source #
A form with "username" and "password" for a user to authenticate with.
Place in front of a POST endpoint.
type AuthenticateAndIssueToken = ReqBody '[FormUrlEncoded] BasicAuthReqBody :> Post '[JSON] (Headers '[Header "Set-Cookie" Text] Text)
Constructors
BasicAuthReqBody | |
Fields
|
Instances
Generic BasicAuthReqBody Source # | |||||
Defined in Monax.Auth.Servant Associated Types
Methods from :: BasicAuthReqBody -> Rep BasicAuthReqBody x # to :: Rep BasicAuthReqBody x -> BasicAuthReqBody # | |||||
FromForm BasicAuthReqBody Source # | |||||
Defined in Monax.Auth.Servant | |||||
type Rep BasicAuthReqBody Source # | |||||
Defined in Monax.Auth.Servant type Rep BasicAuthReqBody = D1 ('MetaData "BasicAuthReqBody" "Monax.Auth.Servant" "monax-auth-api-0.3.0.0-inplace" 'False) (C1 ('MetaCons "BasicAuthReqBody" 'PrefixI 'True) (S1 ('MetaSel ('Just "barbUsername") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text) :*: S1 ('MetaSel ('Just "barbPassword") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedStrict) (Rec0 Text))) |