From a80cc22f9754af66d0d3d26d26bf61276909e127 Mon Sep 17 00:00:00 2001 From: vrockai Date: Fri, 4 Oct 2013 16:19:07 +0200 Subject: [PATCH] KEYCLOAK-86 social registration fix --- forms/src/main/java/org/keycloak/forms/UrlBean.java | 12 ++++++++++++ .../java/org/keycloak/service/FormServiceImpl.java | 3 +++ 2 files changed, 15 insertions(+) diff --git a/forms/src/main/java/org/keycloak/forms/UrlBean.java b/forms/src/main/java/org/keycloak/forms/UrlBean.java index 86b9a6dd54..fdb11feec3 100644 --- a/forms/src/main/java/org/keycloak/forms/UrlBean.java +++ b/forms/src/main/java/org/keycloak/forms/UrlBean.java @@ -34,6 +34,16 @@ public class UrlBean { private RealmBean realm; + private boolean socialRegistration; + + public boolean isSocialRegistration() { + return socialRegistration; + } + + public void setSocialRegistration(boolean socialRegistration) { + this.socialRegistration = socialRegistration; + } + public UrlBean(RealmBean realm, URI baseURI){ this.realm = realm; this.baseURI = baseURI; @@ -82,6 +92,8 @@ public class UrlBean { public String getRegistrationAction() { if (realm.isSaas()) { return Urls.saasRegisterAction(baseURI).toString(); + } else if (socialRegistration){ + return Urls.socialRegisterAction(baseURI, realm.getId()).toString(); } else { return Urls.realmRegisterAction(baseURI, realm.getId()).toString(); } diff --git a/forms/src/main/java/org/keycloak/service/FormServiceImpl.java b/forms/src/main/java/org/keycloak/service/FormServiceImpl.java index 3dedc5e0d8..1cd60fa13a 100644 --- a/forms/src/main/java/org/keycloak/service/FormServiceImpl.java +++ b/forms/src/main/java/org/keycloak/service/FormServiceImpl.java @@ -169,6 +169,7 @@ public class FormServiceImpl implements FormService { attributes.put("realm", realm); UrlBean url = new UrlBean(realm, dataBean.getBaseURI()); + url.setSocialRegistration(dataBean.getSocialRegistration()); attributes.put("url", url); attributes.put("user", new UserBean(dataBean.getUserModel())); @@ -213,6 +214,7 @@ public class FormServiceImpl implements FormService { attributes.put("realm", realm); UrlBean url = new UrlBean(realm, dataBean.getBaseURI()); + url.setSocialRegistration(dataBean.getSocialRegistration()); attributes.put("url", url); attributes.put("user", new UserBean(dataBean.getUserModel())); @@ -236,6 +238,7 @@ public class FormServiceImpl implements FormService { attributes.put("realm", realm); UrlBean url = new UrlBean(realm, dataBean.getBaseURI()); + url.setSocialRegistration(dataBean.getSocialRegistration()); attributes.put("url", url); attributes.put("user", new UserBean(dataBean.getUserModel()));