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