View Source Ueberauth.Strategy.Helpers (Überauth v0.10.5)

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

Add state parameter to the %Plug.Conn{}.

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.

Add state parameter to the options.

Link to this section Functions

Link to this function

add_state_param(conn, value)

View Source
@spec add_state_param(Plug.Conn.t(), String.t()) :: Plug.Conn.t()

Add state parameter to the %Plug.Conn{}.

Link to this function

allowed_callback_method?(conn)

View Source
@spec 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
@spec 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, query_params \\ [])

View Source

Build params for callback

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

@spec 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, query_params \\ [])

View Source

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

The URL is based on the current requests host and scheme.

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")
@spec options(Plug.Conn.t()) :: Keyword.t()

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

@spec redirect!(Plug.Conn.t(), String.t()) :: Plug.Conn.t()

Redirects to a url and halts the plug pipeline.

@spec 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, query_params \\ [])

View Source

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

The URL is based on the current requests host and scheme.

Link to this function

set_errors!(conn, errors)

View Source
@spec set_errors!(Plug.Conn.t(), [Ueberauth.Failure.Error.t()]) :: Plug.Conn.t()

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!.

@spec strategy(Plug.Conn.t()) :: module()

The strategy module that is being used for the request.

@spec 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.

Link to this function

with_state_param(opts, conn)

View Source
@spec with_state_param(
  keyword(),
  Plug.Conn.t()
) :: keyword()

Add state parameter to the options.