cassette_plug v1.1.6 Cassette.Plug View Source
A plug to authenticate using Cassette
When plugged, this will test the session for the presence of the user. When not present it will test for presence of a ticket parameter and validate it. If none of those are present, it will redirect the user to the cas login.
To add to your router:
defmodule Router do
use Plug.Router
plug Cassette.Plug
plug :match
plug :dispatch
(...)
end
Just be sure that your Plug.Session is configured and plugged before Cassette.Plug
If you are using this with phoenix, plug into one of your pipelines:
defmodule MyApp.Router do
use MyApp.Web, :router
pipeline :browser do
(...)
plug :fetch_session
plug Cassette.Plug
plug :fetch_flash
(...)
end
end
Be sure that is module is plugged after the :fetch_session plug since this is a requirement
Customizing behaviour
The behaviour for authentication failures may be customized using your own
Cassette.Plug.AuthenticationHandler.
Please refer to the documentation on that module for more details.
Link to this section Summary
Link to this section Types
options() :: [cassette: Cassette.Support.t(), handler: Cassette.Plug.AuthenticationHandler.t()]
Link to this section Functions
call(Plug.Conn.t(), options()) :: Plug.Conn.t()
Runs this plug.
Your custom Cassette module may be provided with the :cassette key. It will default to the
Cassette module.
Initializes this plug