Configure an OAuth 2.0 authentication
In this topic, you learn how to set up an authentication via OAuth 2.0 and how to configure it in your Cockpit.
Procedure
-
In the Cockpit, go to Settings, and select System Settings.
-
In the Authentication tab, select Edit.
-
Select Add, and select OAuth2.
Result: The Authentication dialog opens.
-
In OAuth2, fill in or select the following fields:
-
Enter a Name for the authentication.
-
Select Active to activate this authentication method.
-
Select Show on login page to display the authentication method on the login page.
-
Enter a Description.
-
Enter a Path to post login data.
Depending on what authentication method you want to use, fill in the following fields accordingly:
- Authorisation URL
- Token URL
- Callback URL
- Redirect URL
- Client ID
- Client Secret
- Scope
- ProfileScript
-
-
In Claims Assignment, select Add to add claims assignments.
-
In Auto Assignment, assign roles and the departments.
-
In Custom Script, to modify the roles' assignment manually, optionally enter your own custom code .
For example, to log user details to view in the system logs when the authentication method is used and to use custom logic to affect the entered variables, enter the following in Custom Script:
log.info("XXuser",user); log.info("XXprofile",profile); log.info("Member of:"+ profile.memberof);
-
Select OK to confirm.
-
In System Settings, select Restart to activate OAuth 2.0 authentication.