ExOauth2Provider v0.3.0 ExOauth2Provider.Plug View Source

ExOauth2Provider.Plug contains functions that assist with interacting with ExOauth2Provider via Plugs.

ExOauth2Provider.Plug is not itself a plug.

Use the helpers to look up current_access_token and current_resource_owner.

Example

ExOauth2Provider.Plug.current_access_token(conn)
ExOauth2Provider.Plug.current_resource_owner(conn)

Link to this section Summary

Functions

Check if a request is authenticated

Check if a request is authenticated

Fetch the currently verified token from the request. Optionally located at a key

Fetch the currently authenticated resource if loaded, optionally located at a key

Link to this section Functions

Link to this function authenticated?(conn) View Source
authenticated?(Plug.Conn.t()) :: boolean()

Check if a request is authenticated

Link to this function authenticated?(conn, type) View Source
authenticated?(Plug.Conn.t(), atom()) :: boolean()

Check if a request is authenticated

Link to this function current_access_token(conn, the_key \\ :default) View Source
current_access_token(Plug.Conn.t(), atom()) ::
  %ExOauth2Provider.OauthAccessTokens.OauthAccessToken{
    __meta__: term(),
    application: term(),
    application_id: term(),
    expires_in: term(),
    id: term(),
    inserted_at: term(),
    previous_refresh_token: term(),
    refresh_token: term(),
    resource_owner: term(),
    resource_owner_id: term(),
    revoked_at: term(),
    scopes: term(),
    token: term(),
    updated_at: term()
  }
  | nil

Fetch the currently verified token from the request. Optionally located at a key

Link to this function current_resource_owner(conn, the_key \\ :default) View Source
current_resource_owner(Plug.Conn.t(), atom()) :: Map.t() | nil

Fetch the currently authenticated resource if loaded, optionally located at a key