Boruta core v0.1.0-rc.4 Boruta.Oauth.Authorization.Scope View Source

Scope authorization

Link to this section Summary

Functions

Authorize the given scope according to the given client.

Link to this section Functions

Link to this function

authorize(list)

View Source
authorize(
  params :: [
    scope: String.t(),
    against: %{
      optional(:client) => %Boruta.Oauth.Client{
        authorize_scope: term(),
        authorized_scopes: term(),
        id: term(),
        redirect_uri: term(),
        secret: term()
      },
      optional(:resource_owner) => %Boruta.Accounts.User{
        __meta__: term(),
        authorized_scopes: term(),
        confirm_password: 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(),
        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"}