From 4d72d3a7b2206a9b9eda4b8f219526173a866ad0 Mon Sep 17 00:00:00 2001 From: Gayan Liyanagamage Date: Fri, 1 May 2020 14:39:23 +0530 Subject: [PATCH 1/2] handling empty callbackurl scenario --- pom.xml | 2 +- src/main/java/org/wso2/keycloak/client/KeycloakClient.java | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index cf56fef..50844c2 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,7 @@ 4.0.0 org.wso2.carbon apim-keymanager-keycloak - 1.0.0 + 1.0.1 bundle Client implementation to integrate with Keycloak Authorization Server http://wso2.org diff --git a/src/main/java/org/wso2/keycloak/client/KeycloakClient.java b/src/main/java/org/wso2/keycloak/client/KeycloakClient.java index e6997af..d1c3786 100644 --- a/src/main/java/org/wso2/keycloak/client/KeycloakClient.java +++ b/src/main/java/org/wso2/keycloak/client/KeycloakClient.java @@ -565,8 +565,11 @@ private String createJsonPayloadFromOauthApplication(OAuthApplicationInfo oAuthA } String clientRedirectUri = oAuthApplicationInfo.getCallBackURL(); - List redirectUris = Collections.singletonList(clientRedirectUri); - paramMap.put(KeycloakConstants.CLIENT_REDIRECT_URIS, redirectUris); + if (!StringUtils.isEmpty(clientRedirectUri)) { + List redirectUris = Collections.singletonList(clientRedirectUri); + paramMap.put(KeycloakConstants.CLIENT_REDIRECT_URIS, redirectUris); + } + Object clientGrantTypes = oAuthApplicationInfo.getParameter(KeycloakConstants.CLIENT_GRANT_TYPES); if (clientGrantTypes != null) { List grantTypes = Arrays.asList(((String) clientGrantTypes).split(",")); From abaef5ab048e4ac6d6fcbb512818a49ce510ed16 Mon Sep 17 00:00:00 2001 From: Gayan Liyanagamage Date: Mon, 4 May 2020 16:36:50 +0530 Subject: [PATCH 2/2] fixing issue when having no client redirect uri --- src/main/java/org/wso2/keycloak/client/KeycloakClient.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/org/wso2/keycloak/client/KeycloakClient.java b/src/main/java/org/wso2/keycloak/client/KeycloakClient.java index b42494e..0e2559e 100644 --- a/src/main/java/org/wso2/keycloak/client/KeycloakClient.java +++ b/src/main/java/org/wso2/keycloak/client/KeycloakClient.java @@ -566,7 +566,7 @@ private String createJsonPayloadFromOauthApplication(OAuthApplicationInfo oAuthA } String clientRedirectUri = oAuthApplicationInfo.getCallBackURL(); - if (!StringUtils.isNotEmpty(clientRedirectUri)) { + if (StringUtils.isNotEmpty(clientRedirectUri)) { List redirectUris = Collections.singletonList(clientRedirectUri); paramMap.put(KeycloakConstants.CLIENT_REDIRECT_URIS, redirectUris); }