Make apiAddClient in the client api return a HttpStatus.Conflict if you try to create a client with a used client id.
This fixes a bug where if you try to create a client with a client id that is already in use, you get an empty error message. Instead, now you get a message that tells you that the client couldn't be created because the client id is already in use.pull/1046/merge
parent
c96be134da
commit
6fb26856a7
|
@ -19,6 +19,7 @@ package org.mitre.openid.connect.web;
|
|||
import java.lang.reflect.Type;
|
||||
import java.text.ParseException;
|
||||
import java.util.Collection;
|
||||
import javax.persistence.PersistenceException;
|
||||
|
||||
import org.mitre.oauth2.model.ClientDetailsEntity;
|
||||
import org.mitre.oauth2.model.ClientDetailsEntity.AuthMethod;
|
||||
|
@ -244,6 +245,11 @@ public class ClientAPI {
|
|||
m.addAttribute(HttpCodeView.CODE, HttpStatus.BAD_REQUEST);
|
||||
m.addAttribute(JsonErrorView.ERROR_MESSAGE, "Unable to save client: " + e.getMessage());
|
||||
return JsonErrorView.VIEWNAME;
|
||||
} catch (PersistenceException e) {
|
||||
logger.error("Unable to save client. Duplicate client id entry found: {}", e.getMessage());
|
||||
m.addAttribute(HttpCodeView.CODE, HttpStatus.CONFLICT);
|
||||
m.addAttribute(JsonErrorView.ERROR_MESSAGE, "Unable to save client. Duplicate client id entry found: " + client.getClientId());
|
||||
return JsonErrorView.VIEWNAME;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue