Boruta.Oauth.Authorization.Scope (Boruta core v0.2.1) View Source

Scope authorization

Link to this section Summary

Functions

Authorize the given scope according to the given client.

Link to this section Functions

Specs

authorize(
  params :: [
    scope: String.t(),
    against: %{
      optional(:client) => %Boruta.Oauth.Client{
        authorize_scope: term(),
        authorized_scopes: term(),
        id: term(),
        redirect_uris: term(),
        secret: term(),
        supported_grant_types: term()
      },
      optional(:resource_owner) => %Boruta.Accounts.User{
        __meta__: term(),
        authorized_scopes: term(),
        current_password: term(),
        email: term(),
        email_confirmation_token: term(),
        email_confirmed_at: term(),
        id: term(),
        inserted_at: term(),
        name: term(),
        password: term(),
        password_hash: term(),
        unconfirmed_email: term(),
        updated_at: term()
      },
      optional(:token) => %Boruta.Oauth.Token{
        client: term(),
        expires_at: term(),
        id: term(),
        inserted_at: term(),
        redirect_uri: term(),
        refresh_token: term(),
        resource_owner: term(),
        revoked_at: term(),
        scope: term(),
        state: term(),
        type: term(),
        value: term()
      }
    }
  ]
) :: {:ok, scope :: String.t()} | {:error, Boruta.Oauth.Error.t()}

Authorize the given scope according to the given client.

Examples

iex> authorize(%{scope: "scope", client: %Client{...}})
{:ok, "scope"}