thentos-core-0.0.1.1: The swiss army knife of privacy-preserving identity management

Safe HaskellNone
LanguageHaskell2010

Thentos.Backend.Api.Auth

Description

Authentication via ThentosSessionToken.

A LESS RELEVANT OBSERVATION: It would be nice if we could provide this function:

>>> thentosAuth :: ActionState
>>> -> ServerT api (Action)
>>> -> Maybe ThentosSessionToken
>>> -> Server api
>>> thentosAuth actionState _api mTok = enter (enterAction actionState mTok) _api

because then here we could write:

>>> api :: ActionState -> Server (ThentosAuth :> MyApi)
>>> api = (`thentosAuth` myApi)

But the signature of thentosAuth requires injectivity of ServerT (api needs to be inferred from `ServerT api (Action)`). ghc-7.12 may help (see https://ghc.haskell.org/trac/ghc/wiki/InjectiveTypeFamilies), or it may not: Even if injective type families are supported, ServerT may not be injective in some particular type that this function is called with.

So instead, you will have to write something like this:

>>> api :: ActionState -> Server (ThentosAuth :> MyApi)
>>> api actionState mTok = enter (enterAction actionState mTok) myApi

Documentation

data ThentosAuth

Instances

HasLink * sub => HasLink * ((:>) * * ThentosAuth sub) 
HasServer * sub => HasServer * ((:>) * * ThentosAuth sub) 
type MkLink * ((:>) * * ThentosAuth sub) = MkLink * sub 
type ServerT * ((:>) * * ThentosAuth sub) m = Maybe ThentosSessionToken -> ServerT * sub m 
type Foreign ((:>) * * ThentosAuth sub) = Foreign sub