in tools/custom_java_jdbc_client/src/main/java/com/example/OAuthUserConfig.java [113:132]
private void validateOAuthUserConfigObject(OAuthUserConfig oAuthUserConfig) {
// Validate that required fields are provided for given user type.
switch (oAuthUserConfig.userType) {
case USER:
case APPLICATION_DEFAULT_CREDENTIALS:
break;
case SERVICE_ACCOUNT:
Objects.requireNonNull(serviceAccountEmail, "serviceAccountEmail cannot be null.");
Objects.requireNonNull(keyFilePath, "Service account keyFilePath cannot be null.");
break;
case TOKEN:
if (accessToken == null && refreshToken == null) {
throw new NullPointerException("At least one of accessToken or refreshToken must be non-null.");
}
break;
case EXTERNAL_ACCOUNT:
Objects.requireNonNull(keyFilePath, "External account keyFilePath cannot be null.");
break;
}
}