OpenID Connect v0.2.2 OpenIDConnect View Source
Handles a majority of the life-cycle concerns with OpenID Connect
Link to this section Summary
Types
The payload of user data from the provider
A provider’s documents
An error tuple
JSON Web Token
The name of the genserver
Query param map
The provider name as an atom
A string reason for an error failure
The success tuple
URI as a string
Functions
Builds the authorization URI according to the spec in the providers discovery document
Fetches the authentication tokens from the provider
Requests updated documents from the provider
Verifies the validity of the JSON Web Token (JWT)
Link to this section Types
The payload of user data from the provider
documents() :: %{ discovery_document: map(), jwk: JOSE.JWK.t(), remaining_lifetime: integer() | nil }
A provider’s documents
- discovery_document: the provider’s discovery document for OpenID Connect
- jwk: the provider’s certificates converted into a JOSE JSON Web Key
- remaining_lifetime: how long the provider’s JWK is valid for
An error tuple
The 2nd element will indicate which function failed The 3rd element will give details of the failure
JSON Web Token
See: https://jwt.io/introduction/
The name of the genserver
This is optional and will default to :openid_connect
unless overridden
Query param map
The provider name as an atom
Example: :google
This atom should match what you’ve used in your application config
A string reason for an error failure
The success tuple
The 2nd element will be the relevant value to work with
URI as a string
Link to this section Functions
Builds the authorization URI according to the spec in the providers discovery document
The params
option can be used to add additional query params to the URI
Example:
OpenIDConnect.authorization_uri(:google, %{"hd" => "dockyard.com"})
It is highly suggested that you add the
state
param for security reasons. Your OpenID Connect provider should have more information on this topic.
Fetches the authentication tokens from the provider
The params
option should at least include the key/value pairs of the response_type
that
was requested during authorization. params
may also include any one-off overrides for token
fetching.
Requests updated documents from the provider
This function is used by OpenIDConnect.Worker
for document updates
according to the lifetime returned by the provider
Verifies the validity of the JSON Web Token (JWT)
This verification will assert the token’s encryption against the provider’s JSON Web Key (JWK)