cassette_plug v1.1.0 Cassette.Plug

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.

Summary

Functions

Runs this plug

Initializes this plug

Types

options :: [cassette: Cassette.Support, handler: Cassette.Plug.AuthenticationHandler]

Functions

call(conn, options)

Specs

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.

init(options)

Specs

init([]) :: []

Initializes this plug