in custos-services/custos-core-services/identity-core-service/src/main/java/org/apache/custos/identity/validator/IdentityInputValidator.java [164:206]
private boolean validateTokenRequest(Object obj) {
if (obj instanceof GetTokenRequest) {
GetTokenRequest request = (GetTokenRequest) obj;
if (request.getTenantId() == 0) {
throw new MissingParameterException("Tenant Id should not be null", null);
}
if (request.getClientId() == null || request.getClientId().trim().equals("")) {
throw new MissingParameterException("Client Id should not be null", null);
}
if (request.getClientSecret() == null || request.getClientSecret().trim().equals("")) {
throw new MissingParameterException("Client secret should not be null", null);
}
if (request.getGrantType() != null && request.getGrantType().equals(Constants.PASSWORD_GRANT_TYPE)) {
if (request.getUsername() == null || request.getUsername().trim().equals("")) {
throw new MissingParameterException("Username should not be null", null);
}
if (request.getPassword() == null || request.getPassword().trim().equals("")) {
throw new MissingParameterException("Password should not be null", null);
}
} else if (request.getGrantType() != null && request.getGrantType().equals(Constants.REFERESH_TOKEN)) {
if (request.getRefreshToken() == null || request.getRefreshToken().trim().equals("")) {
throw new MissingParameterException("Refresh token should not be null", null);
}
} else if (request.getGrantType() == null || !request.getGrantType().equals(Constants.CLIENT_CREDENTIALS)) {
if (request.getRedirectUri() == null || request.getRedirectUri().trim().equals("")) {
throw new MissingParameterException("Redirect Uri should not be null", null);
}
if (request.getCode() == null || request.getCode().trim().equals("")) {
throw new MissingParameterException("code should not be null", null);
}
}
}
return true;
}