Moodle

Moodle uses plugins to manage OpenID Connect authentication.
Download and Install

Download the plugin here.

To install the plugin, follow instructions in the README.md file in the root folder of the archive.

After installation, ensure the plugin files have the correct permissions :

chown -R www-data:www-data oidc/

Configuration

To configure the plugin, from the Moodle Administration block, go to "Site Administration > Plugins > Authentication > Manage Authentication"

Click the icon to enable the plugin, then visit the settings page to configure the plugin

Fill the following fields: {{customValue('tokenURL')}}

Provider Name : leave empty or set the name of your choice
 Client ID : trustelem.oidc.gvsgcy3e
 Client Secret : PMlrIbFW6goMduZkPdaJj8yv99nbT33W{{customValue('tokenURL')}}
 Authorization Endpoint : https://mydomain.trustelem.com/app/383693/auth
 Token Endpoint https://mydomain.trustelem.com/app/383693/token
 Resource https://mydomain.trustelem.com/app/383693/userinfo
 Scope : openid profile email
 ```

* We recommend to activate the following option:

 * Force redirect. You can use the "?noredirect=1" URL param if your configuration is not working

* Setup Trustelem with the following parameters:

 * Your Moodle server URL
 * Login URL: the application's URL starting the OIDC flow. It is used as a target to the application on the Trustelem user's dashboard.
 The URL may be : https://yourmoodledomain/

#### Optional configuration

* You can add the following code in the setClaims function of the "custom claims" section of trustelem application configuration to use user email instead of his identifier as username in Moodle application. 

```ts
claims["sub"] = user.email

