View Source Lightning.AuthProviders.Handler (Lightning v2.10.4)
Module which wraps Oauth configuration and a WellKnown document into a convenient struct that can be used to authenticate users against any OIDC compliant provider.
Summary
Functions
Returns a Handler from a given AuthConfig
Create a new Provider struct, expects a name and opts
Types
@type opts() :: [ client_id: String.t(), client_secret: String.t(), redirect_uri: String.t(), wellknown: Lightning.AuthProviders.WellKnown.t() ]
@type t() :: %Lightning.AuthProviders.Handler{ client: OAuth2.Client.t(), name: String.t(), wellknown: Lightning.AuthProviders.WellKnown.t() }
Functions
@spec from_model(model :: nil | Lightning.AuthProviders.AuthConfig.t()) :: {:ok, t()} | {:error, term()}
Returns a Handler from a given AuthConfig
@spec get_token(handler :: t(), code :: String.t()) :: {:ok, OAuth2.AccessToken.t()} | {:error, map()}
@spec get_userinfo(handler :: t(), token :: OAuth2.AccessToken.t()) :: map()
Create a new Provider struct, expects a name and opts:
:client_id
- The providers issued id:client_secret
- Secret for the client:redirect_uri
- The URI for redirecting after authentication, usually the callback url in the router.:wellknown
- A AuthProviders.WellKnown struct with the providers.well-known/openid-configuration
.