Oidcc.Plug.Authorize (Oidcc Plug v0.3.0)
View SourceInitiate Code Flow Authorization Redirect
defmodule SampleAppWeb.Router do
use Phoenix.Router
# ...
forward "/oidcc/authorize", to: Oidcc.Plug.Authorize,
init_opts: [
provider: SampleApp.GoogleOpenIdConfigurationProvider,
client_id: Application.compile_env!(:sample_app, [Oidcc.Plug.Authorize, :client_id]),
client_secret: Application.compile_env!(:sample_app, [Oidcc.Plug.Authorize, :client_secret]),
redirect_uri: "https://localhost:4000/oidcc/callback"
]
end
Query Params
state
- State to relay to OpenID Provider. Commonly used for target redirect URL after authorization.
Summary
Types
@type opts() :: [ scopes: :oidcc_scope.scopes(), redirect_uri: String.t() | (-> String.t()), url_extension: :oidcc_http_util.query_params(), provider: GenServer.name() | nil, client_store: module() | nil, client_id: String.t() | (-> String.t()) | nil, client_secret: String.t() | (-> String.t()) | nil, client_context_opts: :oidcc_client_context.opts() | (-> :oidcc_client_context.opts()) | nil, client_profile_opts: :oidcc_profile.opts() ]
Plug Configuration Options
Options
scopes
- scopes to requestredirect_uri
- Where to redirect for callbackurl_extension
- Custom query parameters to add to the redirect URIprovider
- name of theOidcc.ProviderConfiguration.Worker
client_id
- OAuth Client ID to use for the introspectionclient_secret
- OAuth Client Secret to use for the introspectionclient_context_opts
- Options for Client Context Initializationclient_profile_opts
- Options for Client Context Profilesclient_store
- A module name that implements theOidcc.Plug.ClientStore
behaviour to fetch the client context from a store instead of using theprovider
,client_id
andclient_secret
directly. This is useful for storing the client context in a database or other persistent storage.