View Source MyApp.CharonOauth2.Grant (CharonOauth2 v0.0.5)

A grant is an (in-progress) Oauth2 flow to obtain auth tokens.

Not every flow needs server-side state to be stored, for example, the implicit grant immediately returns an access token in response to the authorization request, and does not have a second exchange-code-for-token request-response cycle.

Link to this section Summary

Types

Bindings / preloads that can be used with resolve_binding/2 and preload/2

t()

Functions

Insert-only changeset - some things (should) never change.

Sets the current module name as a camelcase named binding in an Ecto query

Preload named bindings. Automatically joins using resolve_binding/2.

Resolve named bindings that are not present in the query by (left-)joining to the appropriate tables.

Link to this section Types

@type resolvable() ::
  :resource_owner
  | :authorization
  | :authorization_client
  | :authorization_resource_owner

Bindings / preloads that can be used with resolve_binding/2 and preload/2

@type t() :: %MyApp.CharonOauth2.Grant{
  __meta__: term(),
  authorization: term(),
  authorization_id: term(),
  code: term(),
  code_challenge: term(),
  expires_at: term(),
  id: term(),
  inserted_at: term(),
  redirect_uri: term(),
  redirect_uri_specified: term(),
  resource_owner: term(),
  resource_owner_id: term(),
  type: term(),
  updated_at: term()
}

Link to this section Functions

Link to this function

insert_only_changeset(struct_or_cs \\ %__MODULE__{}, params)

View Source
@spec insert_only_changeset(t() | Ecto.Changeset.t(), map()) :: Ecto.Changeset.t()

Insert-only changeset - some things (should) never change.

@spec named_binding() :: Ecto.Query.t()

Sets the current module name as a camelcase named binding in an Ecto query

Link to this function

preload(query \\ named_binding(), named_binding_or_bindings)

View Source
@spec preload(Ecto.Query.t(), atom() | [atom()]) :: Ecto.Query.t()

Preload named bindings. Automatically joins using resolve_binding/2.

Link to this function

resolve_binding(query, named_binding)

View Source
@spec resolve_binding(Ecto.Query.t(), atom()) :: Ecto.Query.t()

Resolve named bindings that are not present in the query by (left-)joining to the appropriate tables.