Skip to content

Commit

Permalink
Merge pull request #1001 from pedroigor/master
Browse files Browse the repository at this point in the history
[KEYCLOAK-883] - Reverting change that redirects to error page when fede...
  • Loading branch information
pedroigor committed Feb 26, 2015
2 parents 69da51c + 17653e7 commit cd39d52
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ private Response performLocalAuthentication(FederatedIdentity updatedIdentity, C
federatedUser.addRequiredAction(UPDATE_PROFILE);
}
} catch (Exception e) {
return redirectToErrorPage(e.getMessage(), e);
return redirectToLoginPage(e, clientCode);
}
}

Expand Down Expand Up @@ -447,6 +447,20 @@ private Response redirectToErrorPage(String message, Throwable throwable) {
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) {
fireErrorEvent(message);
return Flows.errors().error(message, Status.BAD_REQUEST);
Expand Down

0 comments on commit cd39d52

Please sign in to comment.