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

An Oauth2 (third-party) client application.

Fields :scope, :grant_types and :redirect_uris are guaranteed to be ordsets (:ordsets).

The client secret is stored encrypted, not hashed, which is unusual for passwords-like secrets. In line with, for example, GCP, we choose to be able to show the client secret again. Also, the client secret is not a normal password but a 384 bits random string, which does not require key stretching to prevent brute forcing (although rate-limiting the token endpoint may still be desirable).

Link to this section Summary

Types

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

t()

Functions

Returns a new query with the current module as named binding :charon_oauth2_client.

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() ::
  :owner
  | :authorizations
  | :authorizations_resource_owner
  | :authorizations_grants
  | :authorizations_grants_resource_owner

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

@type t() :: %MyApp.CharonOauth2.Client{
  __meta__: term(),
  authorizations: term(),
  client_type: term(),
  description: term(),
  grant_types: term(),
  id: term(),
  inserted_at: term(),
  name: term(),
  owner: term(),
  owner_id: term(),
  redirect_uris: term(),
  scope: term(),
  secret: term(),
  updated_at: term()
}

Link to this section Functions

Link to this function

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

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

Basic changeset.

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.

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

Returns a new query with the current module as named binding :charon_oauth2_client.

Link to this function

preload(query \\ named_binding(), named_binding_or_bindings)

View Source
@spec preload(Ecto.Query.t(), resolvable() | [resolvable()]) :: 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(), resolvable()) :: Ecto.Query.t()

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