thentos-adhocracy-0.0.1.1: Thentos-binding for the adhocracy participation platform

Safe HaskellNone
LanguageHaskell2010

Thentos.Adhocracy3.Backend.Api.Simple

Description

This is an implementation of git@github.com:liqdadhocracy3.git:docssourceapi/authentication_api.rst

Synopsis

Documentation

data A3Resource a

Constructors

A3Resource 

Instances

Eq a => Eq (A3Resource a) 
Show a => Show (A3Resource a) 
Generic (A3Resource a) 
ToSample a => ToSample (A3Resource a) 
ToJSON a => ToJSON (A3Resource a) 
FromJSON a => FromJSON (A3Resource a) 
type Rep (A3Resource a) 

newtype Path

Constructors

Path 

Fields

fromPath :: ST
 

Instances

Eq Path 
Ord Path 
Read Path 
Show Path 
Generic Path 
ToSample Path 
ToJSON Path 
FromJSON Path 
type Rep Path 

data RequestResult

Reponse to a login or similar request.

Note: this generic form is useful for parsing a result from A3, but you should never *return* a RequestError because then the status code won't be set correctly. Instead, throw a GenericA3Error or, even better, define and throw a custom error.

type ThentosApi = ("principals" :> ("users" :> (ReqBody `[JSON]` A3UserWithPass :> Post200 `[JSON]` TypedPathWithCacheControl))) :<|> (("activate_account" :> (ReqBody `[JSON]` ActivationRequest :> Post200 `[JSON]` RequestResult)) :<|> (("login_username" :> (ReqBody `[JSON]` LoginRequest :> Post200 `[JSON]` RequestResult)) :<|> (("login_email" :> (ReqBody `[JSON]` LoginRequest :> Post200 `[JSON]` RequestResult)) :<|> ("password_reset" :> (ReqBody `[JSON]` PasswordResetRequest :> Post200 `[JSON]` RequestResult)))))

Note: login_username and login_email have identical behavior. In particular, it is not an error to send username and password to /login_email. This makes implementing all sides of the protocol a lot easier without sacrificing security.

data TypedPath

Similar to A3Resource, but tailored for cases where path and content_type are present and data is absent (or irrelevant).

Constructors

TypedPath 

data TypedPathWithCacheControl

The A3 backend replies to POST request not just with a typed path, but also sends a listing of created/modified etc. resources along to allow the A3 frontend to update its cache.

a3ProxyAdapter :: ProxyAdapter ThentosA3Error

A3-specific ProxyAdapter.

serveApi :: Manager -> HttpConfig -> ActionState -> Application