Main plug that stores KeenAuth configuration in the connection.
This plug must be included in your pipeline before any KeenAuth functionality can be used. It stores the configuration in the connection's private data, making it accessible to controllers and other plugs.
Usage
Add the plug to your router pipeline:
pipeline :authentication do
plug KeenAuth.Plug, otp_app: :my_app
end
scope "/auth" do
pipe_through [:browser, :authentication]
KeenAuth.authentication_routes()
endConfiguration
The plug accepts any configuration options that will be merged with your
application's :keen_auth configuration. Common options:
:otp_app- The OTP application name where configuration is stored:strategies- List of authentication strategies (usually in app config):storage- Custom storage module (defaults to session storage)
Summary
Functions
Callback implementation for Plug.call/2.
Fetch configuration from the private key in the connection.
Callback implementation for Plug.init/1.
Put the provided config as a private key in the connection.
Functions
Callback implementation for Plug.call/2.
@spec fetch_config(Plug.Conn.t()) :: KeenAuth.Config.t()
Fetch configuration from the private key in the connection.
It'll raise an error if configuration hasn't been set as a private key.
Callback implementation for Plug.init/1.
@spec put_config(Plug.Conn.t(), KeenAuth.Config.t()) :: Plug.Conn.t()
Put the provided config as a private key in the connection.