PowAssent v0.1.0 PowAssent.Plug View Source

Plug helper methods.

If you wish to configure PowAssent through the Pow plug interface rather than environment config, please add PowAssent config with :pow_assent config:

plug Pow.Plug.Session,
  repo: MyApp.Repo,
  user: MyApp.User,
  pow_assent: [
    http_adapter: PowAssent.HTTPAdapter.Mint,
    json_library: Poison,
    user_identities_context: MyApp.UserIdentities
  ]

Link to this section Summary

Functions

Calls the authentication method for the strategy provider

Lists available strategy providers for connection

Calls the callback method for the strategy provider

Create a user with user identity

Deletes the associated user identity for the current user and strategy

Lists associated strategy providers for the user

Link to this section Functions

Link to this function authenticate(conn, provider, callback_url) View Source
authenticate(Plug.Conn.t(), binary(), binary()) ::
  {:ok, binary(), Plug.Conn.t()} | {:error.any(), Plug.Conn.t()}

Calls the authentication method for the strategy provider.

A generated redirection URL will be returned.

Link to this function available_providers(conn) View Source
available_providers(Plug.Conn.t() | PowAssent.Config.t()) :: [atom()]

Lists available strategy providers for connection.

Link to this function callback(conn, provider, params) View Source
callback(Plug.Conn.t(), binary(), map()) ::
  {:ok, map(), Plug.Conn.t()}
  | {:error, {:bound_to_different_user | :invalid_user_id_field, map()},
     Plug.Conn.t()}
  | {:error, {:strategy, any()}, Plug.Conn.t()}
  | {:error, map(), Plug.Conn.t()}

Calls the callback method for the strategy provider.

A user will be created if a user doesn’t already exists in connection or for the associated user identity. If a matching user identity association doesn’t exist for the current user, a new user identity is created. Otherwise user is authenticated.

Link to this function create_user(conn, provider, params, user_id_params) View Source
create_user(Plug.Conn.t(), binary(), map(), map()) ::
  {:ok, map(), Plug.Conn.t()} | {:error, map(), Plug.Conn.t()}

Create a user with user identity.

Link to this function delete_identity(conn, provider) View Source
delete_identity(Plug.Conn.t(), binary()) ::
  {:ok, map(), Plug.Conn.t()} | {:error, any(), Plug.Conn.t()}

Deletes the associated user identity for the current user and strategy.

Link to this function providers_for_current_user(conn) View Source
providers_for_current_user(Plug.Conn.t()) :: [atom()]

Lists associated strategy providers for the user.