View Source Plugoid.RedirectURI (plugoid v0.6.0)
Plug to configure the application redirect URI
An OAuth2 / OpenID Connect redirect URI is a vanity, non-dynamic URI. The authorization server redirects to this URI after authentication and authorization success or failure.
automatic-configuration-in-a-router
Automatic configuration in a router
defmodule Myapp.Router do
use Plugoid.RedirectURI
end
installs a route to /openid_connect_redirect_uri
in a Phoenix router.
determining-the-redirect-uri
Determining the redirect URI
When using Plugoid.RedirectURI
, an plugoid_redirect_uri/1
function is automatically
installed in the router. It takes the endpoint as the first parameter and the issuer
as the second:
iex> PlugoidDemoWeb.Router.plugoid_redirect_uri(PlugoidDemoWeb.Endpoint)
"http://localhost:4000/openid_connect_redirect_uri"
It can be called without the endpoint, in which case it is inferred from the router's module name:
iex> PlugoidDemoWeb.Router.plugoid_redirect_uri()
"http://localhost:4000/openid_connect_redirect_uri"
options
Options
:error_view
: the error view to be called in case of error. The:"500"
template is rendered in case of error (bascially, when thestate
parameter is missing from the response). If not set, it will be automatically set toMyApp.ErrorView
whereMyApp
is the base module name of the application:jti_register
: a module implementing theJTIRegister
behaviour, to check the ID Token against replay attack when a nonce is used (in the implicit and hybrid flows). See alsoJTIRegister
:path
: the path of the redirect URI. Defaults to"openid_connect_redirect_uri"
:token_callback
: atoken_callback/0
function to which are passed the received tokens, for further use (for example, to store a refresh token) and returns thePlug.Conn.t/0
Options of OIDC.Auth.verify_opts/0
which will be passed to OIDC.Auth.verify_response/3
.
Link to this section Summary
Link to this section Types
Specs
opt() :: {:error_view, module()} | {:jti_register, module()} | {:path, String.t()} | {:token_callback, token_callback()}
Specs
opts() :: [opt() | OIDC.Auth.verify_opt()]
Specs
token_callback() :: (Plug.Conn.t(), OIDC.Auth.OPResponseSuccess.t(), issuer :: String.t(), client_id :: String.t(), opts() -> Plug.Conn.t())