oauth2_utils v0.1.0 OAuth2Utils.Scope View Source

Util functions to work with OAuth2 scopes

Link to this section Summary

Types

A single scope token as defined in RFC6749 section 3.3

Scope param (i.e. non-empty list of space-separated scopes) as defined in RFC6749 section 3.3

Functions

Checks if the param is a valid OAuth2 scope

Checks if the param is a valid OAuth2 scope param

Link to this section Types

A single scope token as defined in RFC6749 section 3.3

Example: mail:read

Link to this type scope_param() View Source
scope_param() :: String.t()

Scope param (i.e. non-empty list of space-separated scopes) as defined in RFC6749 section 3.3

Link to this section Functions

Link to this function oauth2_scope?(val) View Source
oauth2_scope?(String.t()) :: boolean()

Checks if the param is a valid OAuth2 scope

Example

iex> OAuth2Utils.Scope.oauth2_scope?("document.read")
true
iex> OAuth2Utils.Scope.oauth2_scope?("invalid\scope")
false
Link to this function oauth2_scope_param?(val) View Source
oauth2_scope_param?(scope_param()) :: boolean()

Checks if the param is a valid OAuth2 scope param

Example

iex> OAuth2Utils.Scope.oauth2_scope_param?("users:read feed:edit room:manage")
true
iex> OAuth2Utils.Scope.oauth2_scope_param?("users:read feed:edit  room:manage")
false