Merge remote-tracking branch 'upstream/master'
This commit is contained in:
commit
898195e1da
2 changed files with 10 additions and 1 deletions
|
@ -10,6 +10,7 @@ public interface Errors {
|
|||
String CLIENT_NOT_FOUND = "client_not_found";
|
||||
String CLIENT_DISABLED = "client_disabled";
|
||||
String INVALID_CLIENT_CREDENTIALS = "invalid_client_credentials";
|
||||
String INVALID_CLIENT = "invalid_client";
|
||||
|
||||
String USER_NOT_FOUND = "user_not_found";
|
||||
String USER_DISABLED = "user_disabled";
|
||||
|
|
|
@ -761,8 +761,16 @@ public class TokenService {
|
|||
throw new BadRequestException("Client is not enabled", Response.status(Response.Status.BAD_REQUEST).entity(error).type("application/json").build());
|
||||
}
|
||||
|
||||
if ( (client instanceof ApplicationModel) && ((ApplicationModel)client).isBearerOnly()) {
|
||||
Map<String, String> error = new HashMap<String, String>();
|
||||
error.put(OAuth2Constants.ERROR, "invalid_client");
|
||||
error.put(OAuth2Constants.ERROR_DESCRIPTION, "Bearer-only not allowed");
|
||||
audit.error(Errors.INVALID_CLIENT);
|
||||
throw new BadRequestException("Bearer-only not allowed", Response.status(Response.Status.BAD_REQUEST).entity(error).type("application/json").build());
|
||||
}
|
||||
|
||||
if (!client.isPublicClient()) {
|
||||
if (!client.validateSecret(clientSecret)) {
|
||||
if (clientSecret == null || !client.validateSecret(clientSecret)) {
|
||||
Map<String, String> error = new HashMap<String, String>();
|
||||
error.put(OAuth2Constants.ERROR, "unauthorized_client");
|
||||
audit.error(Errors.INVALID_CLIENT_CREDENTIALS);
|
||||
|
|
Loading…
Reference in a new issue