Rivet.Auth.Graphql (rivet_ident v3.5.0)
View SourceHelpers for Graphql resolvers.
Summary
Functions
This wraps check_authz with logging and creates normal error output for Absinthe to handle.
Accept authorization from a user. Punt to authz_action(), but log graphql bits.
check_authz/2 attempts to verify %Auth.Assertion{} against the specified user, and if the assertion includes a domain reference, it will attempt to walk up the reference tree (if a parent_id exists) and try checking auth again.
Handles extracting the current user from the Absinthe context, and then will
either call func
and pass in the current user or return an error if there is
no user in the context
Types
@type az_assertion() :: Rivet.Auth.Assertion.t()
@type az_log() :: String.t() | nil
@type az_user() :: Rivet.Ident.User.t() | map()
Functions
@spec action( atom(), keyword() ) :: Rivet.Auth.Assertion.t()
This wraps check_authz with logging and creates normal error output for Absinthe to handle.
with {:ok, authed} <- authz(context, %Rivet.Auth.Assertion{}, "doTheThing") do
handle success
end
Accept authorization from a user. Punt to authz_action(), but log graphql bits.
check_authz/2 attempts to verify %Auth.Assertion{} against the specified user, and if the assertion includes a domain reference, it will attempt to walk up the reference tree (if a parent_id exists) and try checking auth again.
Handles extracting the current user from the Absinthe context, and then will
either call func
and pass in the current user or return an error if there is
no user in the context