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;
|
return result;
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
String[] parts = code.split("\\.");
|
result.clientSession = getClientSession(code, session, realm);
|
||||||
String id = parts[1];
|
|
||||||
|
|
||||||
result.clientSession = session.sessions().getClientSession(realm, id);
|
|
||||||
if (result.clientSession == null) {
|
if (result.clientSession == null) {
|
||||||
result.clientSessionNotFound = true;
|
result.clientSessionNotFound = true;
|
||||||
return result;
|
return result;
|
||||||
|
@ -117,10 +114,7 @@ public class ClientSessionCode {
|
||||||
|
|
||||||
public static ClientSessionCode parse(String code, KeycloakSession session, RealmModel realm) {
|
public static ClientSessionCode parse(String code, KeycloakSession session, RealmModel realm) {
|
||||||
try {
|
try {
|
||||||
String[] parts = code.split("\\.");
|
ClientSessionModel clientSession = getClientSession(code, session, realm);
|
||||||
String id = parts[1];
|
|
||||||
|
|
||||||
ClientSessionModel clientSession = session.sessions().getClientSession(realm, id);
|
|
||||||
if (clientSession == null) {
|
if (clientSession == null) {
|
||||||
return 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() {
|
public ClientSessionModel getClientSession() {
|
||||||
return clientSession;
|
return clientSession;
|
||||||
}
|
}
|
||||||
|
|
|
@ -122,7 +122,7 @@ public class TwitterIdentityProvider extends AbstractIdentityProvider<OAuth2Iden
|
||||||
|
|
||||||
twitter.setOAuthConsumer(getConfig().getClientId(), getConfig().getClientSecret());
|
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 twitterToken = clientSession.getNote("twitter_token");
|
||||||
String twitterSecret = clientSession.getNote("twitter_tokenSecret");
|
String twitterSecret = clientSession.getNote("twitter_tokenSecret");
|
||||||
|
|
Loading…
Reference in a new issue