From 839c4e8ede00c8cb52017bd208ae4c58db5b7c79 Mon Sep 17 00:00:00 2001 From: Stian Thorgersen Date: Thu, 20 Oct 2016 15:05:07 +0200 Subject: [PATCH] KEYCLOAK-3772 Login with Twitter is not working --- .../services/managers/ClientSessionCode.java | 16 ++++++++-------- .../social/twitter/TwitterIdentityProvider.java | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/server-spi/src/main/java/org/keycloak/services/managers/ClientSessionCode.java b/server-spi/src/main/java/org/keycloak/services/managers/ClientSessionCode.java index 800ed9c4f3..2710174088 100755 --- a/server-spi/src/main/java/org/keycloak/services/managers/ClientSessionCode.java +++ b/server-spi/src/main/java/org/keycloak/services/managers/ClientSessionCode.java @@ -93,10 +93,7 @@ public class ClientSessionCode { return result; } try { - String[] parts = code.split("\\."); - String id = parts[1]; - - result.clientSession = session.sessions().getClientSession(realm, id); + result.clientSession = getClientSession(code, session, realm); if (result.clientSession == null) { result.clientSessionNotFound = true; return result; @@ -117,10 +114,7 @@ public class ClientSessionCode { public static ClientSessionCode parse(String code, KeycloakSession session, RealmModel realm) { try { - String[] parts = code.split("\\."); - String id = parts[1]; - - ClientSessionModel clientSession = session.sessions().getClientSession(realm, id); + ClientSessionModel clientSession = getClientSession(code, session, realm); if (clientSession == null) { return null; } @@ -135,6 +129,12 @@ public class ClientSessionCode { } } + public static ClientSessionModel getClientSession(String code, KeycloakSession session, RealmModel realm) { + String[] parts = code.split("\\."); + String id = parts[1]; + return session.sessions().getClientSession(realm, id); + } + public ClientSessionModel getClientSession() { return clientSession; } diff --git a/services/src/main/java/org/keycloak/social/twitter/TwitterIdentityProvider.java b/services/src/main/java/org/keycloak/social/twitter/TwitterIdentityProvider.java index 7da4f6198a..c6b340fb1b 100755 --- a/services/src/main/java/org/keycloak/social/twitter/TwitterIdentityProvider.java +++ b/services/src/main/java/org/keycloak/social/twitter/TwitterIdentityProvider.java @@ -122,7 +122,7 @@ public class TwitterIdentityProvider extends AbstractIdentityProvider