License | AGPL-3.0-or-later |
---|---|
Maintainer | monawasensei@gmail.com |
Safe Haskell | None |
Language | GHC2024 |
Monax.Auth.Servant
Description
Synopsis
- class KnownSessionRequired (r :: SessionRequired) where
- type FromSessionRequirement (r :: SessionRequired) a
- decideRequirement :: (r ~ 'NotRequired => a) -> (r ~ 'Required => a) -> a
- fromSessionRequirement :: forall (r :: SessionRequired) a b. KnownSessionRequired r => Proxy a -> (r ~ 'NotRequired => FromSessionRequirement r a -> b) -> (r ~ 'Required => FromSessionRequirement r a -> b) -> FromSessionRequirement r a -> b
- data SessionRequired
- 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
class KnownSessionRequired (r :: SessionRequired) where Source #
Singleton class for SessionRequired
for static dispatch of
types like `ServerT (SessionRequired i r a :> api) m`
Associated Types
type FromSessionRequirement (r :: SessionRequired) a Source #
Methods
decideRequirement :: (r ~ 'NotRequired => a) -> (r ~ 'Required => a) -> a Source #
Branch on a known value.
Instances
KnownSessionRequired 'NotRequired Source # | |||||
Defined in Monax.Auth.Servant Associated Types
Methods decideRequirement :: ('NotRequired ~ 'NotRequired => a) -> ('NotRequired ~ 'Required => a) -> a Source # | |||||
KnownSessionRequired 'Required Source # | |||||
Defined in Monax.Auth.Servant Associated Types
Methods decideRequirement :: ('Required ~ 'NotRequired => a) -> ('Required ~ 'Required => a) -> a Source # |
fromSessionRequirement :: forall (r :: SessionRequired) a b. KnownSessionRequired r => Proxy a -> (r ~ 'NotRequired => FromSessionRequirement r a -> b) -> (r ~ 'Required => FromSessionRequirement r a -> b) -> FromSessionRequirement r a -> b Source #
Case analysis using a static type of kind SessionRequired
.
data SessionRequired Source #
Marks an endpoint as requiring a valid session to proceed.
Constructors
NotRequired | |
Required |
Instances
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 # | |
(KnownSessionRequired r, HasContextEntry context (Tagged i (Sessions SessionID a)), HasContextEntry context (Tagged i Cipher), HasContextEntry context (Tagged i AuthenticationRedirectURL), HasServer api context) => HasServer (SessionCookie i r a :> api :: Type) context Source # | |
Defined in Monax.Auth.Servant Methods route :: Proxy (SessionCookie i r a :> api) -> Context context -> Delayed env (Server (SessionCookie i r a :> api)) -> Router env # hoistServerWithContext :: Proxy (SessionCookie i r a :> api) -> Proxy context -> (forall x. m x -> n x) -> ServerT (SessionCookie i r a :> api) m -> ServerT (SessionCookie i r 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 r a :> api :: Type) m Source # | |
Defined in Monax.Auth.Servant type ServerT (SessionCookie i r a :> api :: Type) m = FromSessionRequirement r (SessionID, a) -> ServerT api m |
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.4.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.4.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))) |