CPub.User.Registration (CPub v0.3.0) View Source

CPub.User.Registration models how a CPub.User is registered and can authenticate with CPub.

Currently there are three types of registration providers:

  • :internal: A password that is stored in the CPub database.
  • :oidc: An external OpenID Connect identity provider
  • :mastodon: A server that implements the Mastodon OAuth protocol

Link to this section Summary

Functions

Check if password matches registered password.

Create an internal registration with a password.

Create an internal registration with a password.

Get the registration for a user.

Link to this section Types

Specs

t() :: %CPub.User.Registration{
  __meta__: term(),
  external_id: String.t(),
  id: String.t(),
  password: String.t(),
  provider: atom() | String.t(),
  site: String.t(),
  user: String.t()
}

Link to this section Functions

Link to this function

check_internal(registration, password)

View Source

Specs

check_internal(t(), String.t()) :: :ok | :invalid_password

Check if password matches registered password.

Link to this function

create_external(user, provider, site, external_id)

View Source

Specs

create_external(CPub.User.t(), atom() | String.t(), String.t(), String.t()) ::
  {:ok, t()} | {:error, any()}

Create an internal registration with a password.

Link to this function

create_internal(user, password)

View Source

Specs

create_internal(CPub.User.t(), String.t()) :: {:ok, t()} | {:error, any()}

Create an internal registration with a password.

Link to this function

get_external(site, provider, external_id)

View Source

Specs

get_external(String.t(), atom() | String.t(), String.t()) ::
  {:ok, t()} | {:error, any()}
Link to this function

get_user_registration(user)

View Source

Specs

get_user_registration(CPub.User.t()) :: {:ok, t()} | {:error, any()}

Get the registration for a user.