phoenix_client_ssl v0.2.0 PhoenixClientSsl.Plug.CommonNameWhitelist
This Plug checks a given common name against patterns.
Best used together with PhoenixClientSsl.Plug.ExtractCommonName
.
Installation
The plug can be installed in any pipeline
of the Phoenix Router. It takes the option patterns
.
Router:
defmodule Aceme.Web.Router do
use Acme.Web, :router
pipeline :api do
plug :accepts, ["json"]
# This line enables the plug
plug PhoenixClientSsl.Plug.CommonNameWhitelist, Application.get_env(:acme, :common_name_whitelist, [])
end
scope "/", Acme.Web do
pipe_through :api
get "/", SomeController, :index
end
end
Config:
config :acme, :common_name_whitelist,
patterns: ["*.example.com"],
handler: &Acme.ErrorHandler.handle_whitelist_error/2
Link to this section Summary
Functions
Check if the common name matches against a given whitelist of patterns
Configuration for Plug
Link to this section Functions
Link to this function
call(conn, map)
Check if the common name matches against a given whitelist of patterns.
Link to this function
init(options)
Configuration for Plug.
Options
patterns
- List of whitelisted patternshandler
- Handler function of failures