SSO Using the OpenIDConnect Protocol
Klevr Portal supports OpenidConnect based external authorisations like Identity Server, Auth0 and Octa in the user-facing front end.
Feature Overview
Klevr Portal supports OpenidConnect based external authorisations like Identity Server, Auth0 and Octa in the user-facing front end. This feature provides an option to the organizations who are already using an external Auth Server for authentication to integrate their existing Identities with Klevr Portal seamlessly and continue to use their existing authentication mechanism to login to Klevr Portal.
Dependencies
The following are dependencies for this feature:
- An OpenIDConnect compattible Authentication Service.
Design Details
In order to utilize an OIDC Server, the following steps are to be followed.
Have an app registered in the external server.
- Make sure the correct redirect URL(s) is configured. (https://<YourPortalURL>/klevr/externalauth/identityserver/site/)
- Make sure the correct Post Logout URL(s) is configured. (/klevr/externalauth/signout/)
- Make sure RequirePKCE is turned on.
- Make sure Response Type ‘code’ is supported.
Get the below information from the app registration.
- a. Authority
- b. Client ID
- c. Client Secret
- d. Response Type
- e. Supported Scopes (openid,profile,email)
Update the pipeline library variable group to include the following:
- Klevr.AllowFrontendISLogin = true
- Klevr.AutoMappingAttribute = <When set the field name is used to fetch the contact information in Dynamics>
- IdentityServer.Authority = <Identity server authority>
- IdentityServer.CallbackPath = "/klevr/externalauth/identityserver/site/"
- IdentityServer.ClientId = <The client ID of the app registration>
- IdentityServer.ClientSecret = <The client secret of the app registration>
- IdentityServer.ResponseType = "code"
- IdentityServer.Scope = "openid,profile,email"
- IdentityServer.SignedOutCallbackPath = "/klevr/externalauth/signout/"
- IdentityServer.ClaimsToMap = <Optional field. Accepts a comma separated list of claims which the application fetchs from identity server and maps to the id_token>
- IdentityServer.IsPost = "true" <Set to true if you would want to use HTTP POST calls to identity server. Else, HTTP GET will be used>
- IdentityServer.ProviderName: The name you want to show on the button, e.g. Octa, Auth0
Once these changes have been made, run the pipeline (this may need to be done twice to ensure the production URL is pointing back towards the correct app service with the custom templates).
After deploying twice, run the model generator from the Umbraco back office.
- Settings > Configuration > Models Builder (Should say models are out of date).
Restart the website (restart the frontend web app where the site is deployed). This is done from the app service resource in the Azure portal.
You can now login with your chosen authentication server.
Username & Email ID requirements when creating/updating a user:
- The username and email id can be different.
- Username should be unique whereas the Email Id need not always be unique.
- An email id must be unique for a local user.
- An email id may not be unique for an external user, provided, it’s used only by external user(s) and not by any local user.
- Below table explains this in detail.
| User Type | Email ID is already used by an existing local user | Email ID is already used by existing external user(s) | Is Email ID Accepted for user creation/update? |
|---|---|---|---|
| Local User | Yes | No | No |
| Local User | No | Yes | No |
| Local User | No | No | Yes |
| External User | Yes | No | No |
| External User | No | Yes | Yes |
| External User | No | No | Yes |
- In order to login, make sure the account you are logging in with is registered in the OIDC provider (or have self-registration enabled in the provider too).
- If the contact already exists in the Dynamics CRM, then you must either use "AutoMappingAttribute" (see below) or use the invitation process to merge the contacts on initial sign-in. If the user logs in without using the invitation process, and self-registration is allowed, a new CRM contact will automatically be created and linked with the user. This can be switched to the original contact by updating the Dynamics GUID for the newly created member in the Umbraco back office.
- To use AutoMappingAttribute, set Klevr.AutoMappingAttribute in the library settings to a schema name of a field on the contact entity that will match the login name of the external identity. For example: Create a field called something like ws_3rdPartyIdentity on the contact entity. update a contact record, setting this new field's value to the username from the external identity server (which could be an email address or some other username like a student id). Set the AutoMappingAttribute to ws_3rdPartyIdentity (or whatever you called your field on contact). When the person logs in for the first time using their existing external auth login, the Portal will find the contact record where ws_3rdPartyIdentity matches their login name, and then link this login to that contact record. Ensure you don't have duplicate values in this field for different contacts.
- If self-registration is turned off, users will be able to login with Identity Server on their FIRST attempt without the invitation code as long as a contact with the field name configured as Klevr.AutoMappingAttribute is present in Dynamics CRM and has the value of the current user’s username. Else, the login is rejected. Once, the FIRST login is successful, the user can login normally.
Last updated on