OpenID Connect
Introduction¶
The page covering authentication explains how to authenticate with a basic username/password for a user created directly in Mauro. An alternative authentication method is to use an OpenID Connect identity service to authenticate users with an external provider/account system, and then authorize them to use Mauro.
In order use OpenID Connect identity providers, the Mauro instance must:
- Have the Mauro OpenID Connect Authentication plugin installed.
- Set up and configure one or more identity services that support the OpenID Connect protocol.
- Add the configuration details of each identity provider to Mauro.
The full details of this set up can be viewed in the user guide Using OpenID Connect.
Authenticating users¶
Assuming that the Mauro instance has been configured correctly and there is at least one OpenID Connect provider configured in Mauro, endpoints will be exposed to handle authentication using those external services.
Using authorization endpoints¶
There is an endpoint to fetch a list of OpenID Connect providers available in Mauro, which will provide the authorization endpoints:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
|
The authorizationEndpoint
is the key property value in each case, as this provides the URL to redirect to in order to start authenticating in the external service. The authorizationEndpoint
value must include an additional query parameter added by yourself called redirect_uri
: this is the URL to the page that the identity provider will redirect back to once it has authenticated a user, also providing the session state needed for Mauro to authorize the user session.
Information
Before redirecting to the external identity server, track the id
value of the OpenID Connect provider somewhere. This will be required later when authorizing the Mauro user session.
Mauro authorization¶
When the OpenID Connect identity provider redirects back to the client (via the redirect_uri
provided), it will provide three query parameters in the URL:
state
session_state
code
All these parameters must be captured and the passed to the standard Mauro authentication endpoint via the request body:
1 2 3 4 5 6 7 |
|
Information
The redirectUri
passed to the login request body must exactly match that passed as the redirect_uri
query parameter at the point of redirecting to the OpenID Connect service.
If successful, the /api/authentication/login
endpoint will return the same response as a standard login using a username and password. The user is now signed into Mauro and has an active session. The user also uses the same permissions and user groups model for accessing catalogue content as any other user.
Administration¶
Information
The following endpoints can only be accessed by an administrator user.
Getting providers¶
To get a list of available OpenID Connect providers registered in Mauro, the following endpoint can be used:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
|
To get the full details of a particular OpenID Connect provider:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
|
Creating a provider¶
To add an OpenID Connect provider to Mauro depends on what discovery information is available. There are two types of provider in Mauro:
- Standard - a
discoveryDocumentUrl
is provided, which allows Mauro to discover all other necessary endpoints to complete the setup of the provider (authorization, tokens, etc). - Non-Standard - when a
discoveryDocumentUrl
is not available, the individual endpoints needed to complete the OpenID Connect provider setup can be provided manually.
Both use the following endpoint, but sends different request body content.
To create a Standard provider, include a similar request body:
1 2 3 4 5 6 7 8 |
|
Information
imageUrl
is an optional field.
To create a Non-Standard provider:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
|
Information
userinfoEndpoint
and endSessionEndpoint
are optional, all other discovery endpoints are required.
If successful, both return the same response as getting a provider.
Update / Delete¶
To edit the properties of an OpenID Connect provider, use the following endpoints, with a request body similar to the JSON described in Creating a provider.
To delete an OpenID Connect provider, use the following endpoint.