Ü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
allowed_callback_method?(conn)
View Source
allowed_callback_method?(Plug.Conn.t()) :: boolean()
allowed_callback_method?(Plug.Conn.t()) :: boolean()
Is the current request http method one of the allowed callback methods?
allowed_callback_methods(conn)
View Source
allowed_callback_methods(Plug.Conn.t()) :: [String.t()]
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
callback_params(conn, opts \\ []) View Source
Build params for callback
This method will filter conn.params with whitelisted params from :callback_params settings
callback_path(conn)
View Source
callback_path(Plug.Conn.t()) :: String.t()
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.
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.
error(key, message)
View Source
error(String.t(), String.t()) :: Ueberauth.Failure.Error.t()
error(Plug.Conn.t(), [Ueberauth.Failure.Error.t()]) :: Plug.Conn.t()
error(String.t(), String.t()) :: Ueberauth.Failure.Error.t()
error(Plug.Conn.t(), [Ueberauth.Failure.Error.t()]) :: Plug.Conn.t()
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")
options(conn)
View Source
options(Plug.Conn.t()) :: Keyword.t()
options(Plug.Conn.t()) :: Keyword.t()
The full list of options passed to the strategy in the configuration.
redirect!(conn, url)
View Source
redirect!(Plug.Conn.t(), String.t()) :: Plug.Conn.t()
redirect!(Plug.Conn.t(), String.t()) :: Plug.Conn.t()
Redirects to a url and halts the plug pipeline.
request_path(conn)
View Source
request_path(Plug.Conn.t()) :: String.t()
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.
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.
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!
.
strategy(conn)
View Source
strategy(Plug.Conn.t()) :: module()
strategy(Plug.Conn.t()) :: module()
The strategy module that is being used for the request.
strategy_name(conn)
View Source
strategy_name(Plug.Conn.t()) :: String.t()
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.