KEYCLOAK-3772
Login with Twitter is not working
This commit is contained in:
parent
9c7e9da9fa
commit
839c4e8ede
2 changed files with 9 additions and 9 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -122,7 +122,7 @@ public class TwitterIdentityProvider extends AbstractIdentityProvider<OAuth2Iden
|
|||
|
||||
twitter.setOAuthConsumer(getConfig().getClientId(), getConfig().getClientSecret());
|
||||
|
||||
ClientSessionModel clientSession = parseClientSessionCode(state).getClientSession();
|
||||
ClientSessionModel clientSession = ClientSessionCode.getClientSession(state, session, realm);
|
||||
|
||||
String twitterToken = clientSession.getNote("twitter_token");
|
||||
String twitterSecret = clientSession.getNote("twitter_tokenSecret");
|
||||
|
|
Loading…
Reference in a new issue