Boruta.Oauth.Scope (Boruta core v2.3.5)

View Source

OAuth scope schema and utilities

Summary

Functions

Determines if artifact is authorized to access given scope.

Determines if scope string contains openid scope.

Returns 'openid' scope

Splits an OAuth scope string into individual scopes as string

Types

raw()

@type raw() :: String.t()

t()

@type t() :: %Boruta.Oauth.Scope{
  id: any() | nil,
  label: String.t() | nil,
  name: String.t(),
  public: boolean() | nil
}

Functions

authorized_scopes(against, scopes, public_scopes \\ [])

@spec authorized_scopes(
  against :: List | Boruta.Oauth.Token.t() | Boruta.Oauth.Client.t(),
  scopes :: [String.t()],
  public_scopes :: [String.t()]
) :: authorized_scopes :: [String.t()]

Determines if artifact is authorized to access given scope.

contains_openid?(scope)

@spec contains_openid?(oauth_scope :: String.t()) :: boolean()

Determines if scope string contains openid scope.

openid()

@spec openid() :: t()

Returns 'openid' scope

split(scope)

@spec split(oauth_scope :: String.t() | nil) :: [raw()]

Splits an OAuth scope string into individual scopes as string

Examples

iex> scope("a:scope another:scope")
["a:scope", "another:scope"]