phoenix_client_ssl v0.5.0 PhoenixClientSsl.Plug.ExtractCommonName

This Plug extracts the Common Name of a certificate in eligible connections.

Best used together with PhoenixClientSsl.Plug.ExtractClientCertificate.

Installation

The plug can be installed in any pipeline of the Phoenix Router. It takes no options.

defmodule Aceme.Web.Router do
  use Acme.Web, :router

  pipeline :api do
    plug :accepts, ["json"]

    # This line enables the plug
    plug PhoenixClientSsl.Plug.ExtractCommonName
  end

  scope "/", Acme.Web do
    pipe_through :api

    get "/", SomeController, :index
  end
end

Link to this section Summary

Functions

Extract the Common Name of a certificate in eligible connections.

No configuration needed.

Link to this section Functions

Link to this function

call(conn, options)

Extract the Common Name of a certificate in eligible connections.

Skipping if either the common name is already set or the connection has no client certificate.

No configuration needed.