Überauth v0.6.3 Ueberauth.Strategy.Helpers View Source

Provides helper methods for use within your strategy.

These helpers are provided as a convenience for accessing the options passed to the specific pipelined strategy, considering the pipelined options and falling back to defaults.

Link to this section Summary

Functions

Is the current request http method one of the allowed callback methods?

The configured allowed callback http methods

Build params for callback

The callback path for the requests strategy

The full URL for the callback phase for the requests strategy

A helper for constructing error entries on failure

The full list of options passed to the strategy in the configuration

Redirects to a url and halts the plug pipeline

The request path for the strategy to hit

The full url for the request phase for the requests strategy

Sets a failure onto the connection containing a List of errors

The strategy module that is being used for the request

Provides the name of the strategy or provider name

Link to this section Functions

Link to this function

allowed_callback_method?(conn) View Source
allowed_callback_method?(Plug.Conn.t()) :: boolean()

Is the current request http method one of the allowed callback methods?

Link to this function

allowed_callback_methods(conn) View Source
allowed_callback_methods(Plug.Conn.t()) :: [String.t()]

The configured allowed callback http methods.

This will use any supplied options from the configuration, but fallback to the default options

Link to this function

callback_params(conn, opts \\ []) View Source

Build params for callback

This method will filter conn.params with whitelisted params from :callback_params settings

Link to this function

callback_path(conn) View Source
callback_path(Plug.Conn.t()) :: String.t()

The callback path for the requests strategy.

When a client hits this path, the callback phase will be triggered for the strategy.

Link to this function

callback_url(conn, opts \\ []) View Source

The full URL for the callback phase for the requests strategy.

The URL is based on the current requests host and scheme. The options will be encoded as query params.

A helper for constructing error entries on failure.

The message_key is intended for use by machines for translations etc. The message is a human readable error message.

Example

error("something_bad", "Something really bad happened")

The full list of options passed to the strategy in the configuration.

Link to this function

redirect!(conn, url) View Source
redirect!(Plug.Conn.t(), String.t()) :: Plug.Conn.t()

Redirects to a url and halts the plug pipeline.

Link to this function

request_path(conn) View Source
request_path(Plug.Conn.t()) :: String.t()

The request path for the strategy to hit.

Requests to this path will trigger the request_phase of the strategy.

Link to this function

request_url(conn, opts \\ []) View Source

The full url for the request phase for the requests strategy.

The URL is based on the current requests host and scheme. The options will be encoded as query params.

Link to this function

set_errors!(conn, errors) View Source

Sets a failure onto the connection containing a List of errors.

During your callback phase, this should be called to 'fail' the authentication request and include a collection of errors outlining what the problem is.

Note this changes the conn object and should be part of your returned connection of the callback_phase!.

The strategy module that is being used for the request.

Link to this function

strategy_name(conn) View Source
strategy_name(Plug.Conn.t()) :: String.t()

Provides the name of the strategy or provider name.

This is defined in your configuration as the provider name.