ExScim.Authorization.Adapter behaviour (ex_scim v0.3.0)

Copy Markdown View Source

Implements an authorization policy and decides whether an authenticated ExScim.Scope may perform an action on a resource.

Summary

Types

Indicate missing scopes or other reason for denying access.

Callbacks

Returns :ok when scope may perform action on resource, {:error, denial} otherwise.

Types

action()

@type action() :: :read | :create | :update | :delete

denial()

@type denial() :: {:missing_scopes, [String.t()]} | term()

Indicate missing scopes or other reason for denying access.

resource()

@type resource() ::
  :users | :groups | :me | :schemas | :resource_types | :service_provider_config

Callbacks

authorize(scope, resource, action)

@callback authorize(scope :: ExScim.Scope.t(), resource(), action()) ::
  :ok | {:error, denial()}

Returns :ok when scope may perform action on resource, {:error, denial} otherwise.