if (clientAuth == null && grant.getType().requiresClientAuthentication()) {
throw new ParseException("Missing client authentication", OAuth2Error.INVALID_CLIENT);
}
// Parse client id
ClientID clientID = null;
if (clientAuth == null) {
// Parse optional client ID
String clientIDString = params.get("client_id");
if (clientIDString != null && clientIDString.trim().length() > 0)
clientID = new ClientID(clientIDString);
if (clientID == null && grant.getType().requiresClientID()) {
throw new ParseException("Missing required \"client_id\" parameter", OAuth2Error.INVALID_REQUEST);
}
}