change exchange error message

This commit is contained in:
Bill Burke 2017-10-02 11:29:59 -04:00
parent 817d6cc8c7
commit ef60512e09

View file

@ -94,16 +94,16 @@ public abstract class AbstractIdentityProvider<C extends IdentityProviderModel>
} }
public Response exchangeNotLinked(UriInfo uriInfo, ClientModel authorizedClient, UserSessionModel tokenUserSession, UserModel tokenSubject) { public Response exchangeNotLinked(UriInfo uriInfo, ClientModel authorizedClient, UserSessionModel tokenUserSession, UserModel tokenSubject) {
return exchangeErrorResponse(uriInfo, authorizedClient, tokenUserSession, "identity provider is not linked"); return exchangeErrorResponse(uriInfo, authorizedClient, tokenUserSession, "not_linked", "identity provider is not linked");
} }
public Response exchangeNotLinkedNoStore(UriInfo uriInfo, ClientModel authorizedClient, UserSessionModel tokenUserSession, UserModel tokenSubject) { public Response exchangeNotLinkedNoStore(UriInfo uriInfo, ClientModel authorizedClient, UserSessionModel tokenUserSession, UserModel tokenSubject) {
return exchangeErrorResponse(uriInfo, authorizedClient, tokenUserSession, "identity provider is not linked, can only link to current user session"); return exchangeErrorResponse(uriInfo, authorizedClient, tokenUserSession, "not_linked", "identity provider is not linked, can only link to current user session");
} }
protected Response exchangeErrorResponse(UriInfo uriInfo, ClientModel authorizedClient, UserSessionModel tokenUserSession, String reason) { protected Response exchangeErrorResponse(UriInfo uriInfo, ClientModel authorizedClient, UserSessionModel tokenUserSession, String errorCode, String reason) {
Map<String, String> error = new HashMap<>(); Map<String, String> error = new HashMap<>();
error.put("error", "invalid_target"); error.put("error", errorCode);
error.put("error_description", reason); error.put("error_description", reason);
String accountLinkUrl = getLinkingUrl(uriInfo, authorizedClient, tokenUserSession); String accountLinkUrl = getLinkingUrl(uriInfo, authorizedClient, tokenUserSession);
if (accountLinkUrl != null) error.put(ACCOUNT_LINK_URL, accountLinkUrl); if (accountLinkUrl != null) error.put(ACCOUNT_LINK_URL, accountLinkUrl);
@ -133,7 +133,7 @@ public abstract class AbstractIdentityProvider<C extends IdentityProviderModel>
} }
public Response exchangeTokenExpired(UriInfo uriInfo, ClientModel authorizedClient, UserSessionModel tokenUserSession, UserModel tokenSubject) { public Response exchangeTokenExpired(UriInfo uriInfo, ClientModel authorizedClient, UserSessionModel tokenUserSession, UserModel tokenSubject) {
return exchangeErrorResponse(uriInfo, authorizedClient, tokenUserSession, "token_expired"); return exchangeErrorResponse(uriInfo, authorizedClient, tokenUserSession, "token_expired", "linked token is expired");
} }
public Response exchangeUnsupportedRequiredType() { public Response exchangeUnsupportedRequiredType() {