// Set the status and return the error message.
response.setStatus(oauthResponse.getResponseStatus());
return oauthResponse.getBody();
}
// Validate the scopes.
Registry registry = Registry.getInstance();
for(String scope : scopes) {
if(registry.getSchemas(scope, null, 0, 1).size() != 1) {
// Create the OAuth response.
OAuthResponse oauthResponse =
OAuthASResponse
.errorResponse(HttpServletResponse.SC_BAD_REQUEST)
.setError(CodeResponse.INVALID_SCOPE)