You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openmeetings.apache.org by so...@apache.org on 2022/06/02 08:43:30 UTC

[openmeetings] branch master updated: [OPENMEETINGS-2627] example for Keycloak is added

This is an automated email from the ASF dual-hosted git repository.

solomax pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/openmeetings.git


The following commit(s) were added to refs/heads/master by this push:
     new c070acc03 [OPENMEETINGS-2627] example for Keycloak is added
c070acc03 is described below

commit c070acc03c600f104911fcf3821690f4de7852a4
Author: Maxim Solodovnik <so...@gmail.com>
AuthorDate: Thu Jun 2 15:43:20 2022 +0700

    [OPENMEETINGS-2627] example for Keycloak is added
---
 .../openmeetings/installation/ImportInitvalues.java    | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

diff --git a/openmeetings-install/src/main/java/org/apache/openmeetings/installation/ImportInitvalues.java b/openmeetings-install/src/main/java/org/apache/openmeetings/installation/ImportInitvalues.java
index 4dea4de8c..d94f9e4c4 100644
--- a/openmeetings-install/src/main/java/org/apache/openmeetings/installation/ImportInitvalues.java
+++ b/openmeetings-install/src/main/java/org/apache/openmeetings/installation/ImportInitvalues.java
@@ -580,6 +580,24 @@ public class ImportInitvalues {
 				.addMapping(PARAM_EMAIL, EMAIL_PARAM)
 				.addMapping(PARAM_FNAME, FNAME_PARAM)
 				.addMapping(PARAM_LNAME, LNAME_PARAM), null);
+
+		// keycloak
+		oauthDao.update(new OAuthServer()
+				.setName("keycloak")
+				.setIconUrl("https://www.keycloak.org/resources/images/keycloak_icon_512px.svg")
+				.setEnabled(false)
+				.setClientId(CLIENT_PLACEHOLDER)
+				.setClientSecret(SECRET_PLACEHOLDER)
+				.setRequestKeyUrl("<KeycloakBaseUrl>/auth/realms/uweslan/protocol/openid-connect/auth?redirect_uri={$redirect_uri}&client_id={$client_id}&response_type=code&scope=email")
+				.setRequestTokenUrl("<KeycloakBaseUrl>/auth/realms/<--custom-realm-->/protocol/openid-connect/token")
+				.setRequestTokenMethod(RequestTokenMethod.POST)
+				.setRequestTokenAttributes("code={$code}&client_id={$client_id}&client_secret={$client_secret}&redirect_uri={$redirect_uri}&grant_type=authorization_code")
+				.setRequestInfoUrl("<KeycloakBaseUrl>/auth/realms/<--custom-realm-->/protocol/openid-connect/userinfo")
+				.setRequestInfoMethod(RequestInfoMethod.HEADER)
+				.addMapping(PARAM_LOGIN, EMAIL_PARAM)
+				.addMapping(PARAM_EMAIL, EMAIL_PARAM)
+				.addMapping(PARAM_FNAME, "given_name")
+				.addMapping(PARAM_LNAME, "family_name"), null);
 	}
 
 	// ------------------------------------------------------------------------------