more properly respond to some client registration errors
parent
c493f438e7
commit
4e52543091
|
@ -175,9 +175,12 @@ public class ClientDynamicRegistrationEndpoint {
|
||||||
return "httpCodeView";
|
return "httpCodeView";
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
logger.error("Couldn't save client", e);
|
logger.error("Couldn't save client", e);
|
||||||
m.addAttribute("code", HttpStatus.BAD_REQUEST);
|
|
||||||
|
m.addAttribute("error", "invalid_client_metadata");
|
||||||
return "httpCodeView";
|
m.addAttribute("errorMessage", "Unable to save client due to invalid or inconsistent metadata.");
|
||||||
|
m.addAttribute("code", HttpStatus.BAD_REQUEST); // http 400
|
||||||
|
|
||||||
|
return "jsonErrorView";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// didn't parse, this is a bad request
|
// didn't parse, this is a bad request
|
||||||
|
@ -301,15 +304,18 @@ public class ClientDynamicRegistrationEndpoint {
|
||||||
m.addAttribute("code", HttpStatus.OK); // http 200
|
m.addAttribute("code", HttpStatus.OK); // http 200
|
||||||
|
|
||||||
return "clientInformationResponseView";
|
return "clientInformationResponseView";
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
logger.error("Couldn't save client", e);
|
|
||||||
m.addAttribute("code", HttpStatus.BAD_REQUEST);
|
|
||||||
|
|
||||||
return "httpCodeView";
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
logger.error("Unsupported encoding", e);
|
logger.error("Unsupported encoding", e);
|
||||||
m.addAttribute("code", HttpStatus.INTERNAL_SERVER_ERROR);
|
m.addAttribute("code", HttpStatus.INTERNAL_SERVER_ERROR);
|
||||||
return "httpCodeView";
|
return "httpCodeView";
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
logger.error("Couldn't save client", e);
|
||||||
|
|
||||||
|
m.addAttribute("error", "invalid_client_metadata");
|
||||||
|
m.addAttribute("errorMessage", "Unable to save client due to invalid or inconsistent metadata.");
|
||||||
|
m.addAttribute("code", HttpStatus.BAD_REQUEST); // http 400
|
||||||
|
|
||||||
|
return "jsonErrorView";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// client mismatch
|
// client mismatch
|
||||||
|
|
|
@ -181,9 +181,12 @@ public class ProtectedResourceRegistrationEndpoint {
|
||||||
return "httpCodeView";
|
return "httpCodeView";
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
logger.error("Couldn't save client", e);
|
logger.error("Couldn't save client", e);
|
||||||
m.addAttribute("code", HttpStatus.BAD_REQUEST);
|
|
||||||
|
m.addAttribute("error", "invalid_client_metadata");
|
||||||
return "httpCodeView";
|
m.addAttribute("errorMessage", "Unable to save client due to invalid or inconsistent metadata.");
|
||||||
|
m.addAttribute("code", HttpStatus.BAD_REQUEST); // http 400
|
||||||
|
|
||||||
|
return "jsonErrorView";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// didn't parse, this is a bad request
|
// didn't parse, this is a bad request
|
||||||
|
@ -354,15 +357,18 @@ public class ProtectedResourceRegistrationEndpoint {
|
||||||
m.addAttribute("code", HttpStatus.OK); // http 200
|
m.addAttribute("code", HttpStatus.OK); // http 200
|
||||||
|
|
||||||
return "clientInformationResponseView";
|
return "clientInformationResponseView";
|
||||||
} catch (IllegalArgumentException e) {
|
|
||||||
logger.error("Couldn't save client", e);
|
|
||||||
m.addAttribute("code", HttpStatus.BAD_REQUEST);
|
|
||||||
|
|
||||||
return "httpCodeView";
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
} catch (UnsupportedEncodingException e) {
|
||||||
logger.error("Unsupported encoding", e);
|
logger.error("Unsupported encoding", e);
|
||||||
m.addAttribute("code", HttpStatus.INTERNAL_SERVER_ERROR);
|
m.addAttribute("code", HttpStatus.INTERNAL_SERVER_ERROR);
|
||||||
return "httpCodeView";
|
return "httpCodeView";
|
||||||
|
} catch (IllegalArgumentException e) {
|
||||||
|
logger.error("Couldn't save client", e);
|
||||||
|
|
||||||
|
m.addAttribute("error", "invalid_client_metadata");
|
||||||
|
m.addAttribute("errorMessage", "Unable to save client due to invalid or inconsistent metadata.");
|
||||||
|
m.addAttribute("code", HttpStatus.BAD_REQUEST); // http 400
|
||||||
|
|
||||||
|
return "jsonErrorView";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// client mismatch
|
// client mismatch
|
||||||
|
|
Loading…
Reference in New Issue