[KEYCLOAK-883] - Reverting change that redirects to error page when federating identities..

This commit is contained in:
pedroigor 2015-02-26 15:27:10 -03:00
parent 69da51cc56
commit 17653e7e74

View file

@ -323,7 +323,7 @@ public class IdentityBrokerService {
federatedUser.addRequiredAction(UPDATE_PROFILE); federatedUser.addRequiredAction(UPDATE_PROFILE);
} }
} catch (Exception e) { } catch (Exception e) {
return redirectToErrorPage(e.getMessage(), e); return redirectToLoginPage(e, clientCode);
} }
} }
@ -447,6 +447,20 @@ public class IdentityBrokerService {
return Flows.forwardToSecurityFailurePage(this.session, this.realmModel, this.uriInfo, message); return Flows.forwardToSecurityFailurePage(this.session, this.realmModel, this.uriInfo, message);
} }
private Response redirectToLoginPage(Throwable t, ClientSessionCode clientCode) {
String message = t.getMessage();
if (message == null) {
message = "Unexpected error when authenticating with identity provider";
}
fireErrorEvent(message);
return Flows.forms(this.session, this.realmModel, clientCode.getClientSession().getClient(), this.uriInfo)
.setClientSessionCode(clientCode.getCode())
.setError(message)
.createLogin();
}
private Response badRequest(String message) { private Response badRequest(String message) {
fireErrorEvent(message); fireErrorEvent(message);
return Flows.errors().error(message, Status.BAD_REQUEST); return Flows.errors().error(message, Status.BAD_REQUEST);