-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Server implementation of the Avers API -- -- See README.md @package avers-server @version 0.0.5 module Avers.Server serveAversCoreAPI :: Handle -> Authorizations -> Server AversCoreAPI serveAversSessionAPI :: Handle -> Server AversSessionAPI -- | Convert the Credentials into an ObjId to which the -- ceredentials refer. That's the object the client is authenticated as. credentialsObjId :: Handle -> Credentials -> ExceptT ServantErr IO ObjId -- | Defines all the authorization points which are used in the server. For -- each you can supply your own logic. The default is to allow -- everything. data Authorizations Authorizations :: (Credentials -> Text -> Authz) -> (Credentials -> ObjId -> Authz) -> Authorizations [createObjectAuthz] :: Authorizations -> Credentials -> Text -> Authz [lookupObjectAuthz] :: Authorizations -> Credentials -> ObjId -> Authz -- | Authorization logic is implemented as a list of Avers actions, -- each of which we call a module and returns a result -- (AuthzR), which determines what happens next. type Authz = [Avers AuthzR] -- | The result of a single module is either ContinueR, which means -- we continue executing following modules, AllowR which means -- that the action is allowed and any following modules are skipped, or -- RejcetR which means that the action is rejected and following -- modules are skipped as well. data AuthzR ContinueR :: AuthzR AllowR :: AuthzR RejectR :: AuthzR defaultAuthorizations :: Authorizations -- | Run the authorization logic inside of the Servant monad. runAuthorization :: Handle -> Authz -> ExceptT ServantErr IO () -- | This doesn't change the result, but allows you to run arbitrary -- Avers actions. This is useful for debugging. trace :: Avers () -> Avers AuthzR -- | If the given Avers action returns True, it is sufficient -- to pass the authorization check. sufficient :: Avers Bool -> Avers AuthzR -- | The given Avers action must return True for this -- authorization check to pass. requisite :: Avers Bool -> Avers AuthzR