return client;
}
// Get the Client and check the id and secret
private Client getAndValidateClient(String clientId, String clientSecret) {
Client client = getClient(clientId);
if (canSupportPublicClients
&& !client.isConfidential()
&& client.getClientSecret() == null
&& client.getRedirectUris().isEmpty()
&& clientSecret == null) {
return client;
}
if (clientSecret == null || client.getClientSecret() == null
|| !client.getClientId().equals(clientId)
|| !client.getClientSecret().equals(clientSecret)) {
throw new NotAuthorizedException(Response.status(401).build());
}
return client;
}