plugoid v0.4.0 Plugoid.RedirectURI View Source
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
defmodule Myapp.Router do
use Plugoid.RedirectURI
end
installs a route to /openid_connect_redirect_uri
in a Phoenix router.
Determining the redirect URI
When using Plugoid.RedirectURI
, an plugoid_redirect_uri/2
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, "https://issuer.example.com/auth")
"http://localhost:4000/openid_connect_redirect_uri?iss=https://issuer.example.com/auth"
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("https://issuer.example.com/auth")
"http://localhost:4000/openid_connect_redirect_uri?iss=https://issuer.example.com/auth"
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)
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() :: (OIDC.Auth.OPResponseSuccess.t(), issuer :: String.t(), client_id :: String.t(), opts() -> any())