Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class OAuthURL implements URL {
private static final KCLogger LOGGER = new KCLogger(OAuthURL.class.getName());

private static final String OAUTH_SERVER_URL_REGEX_PATTERN =
"^(https?://)?((([\\w\\d-]+)(\\.[\\w\\d-]+)*)(:(\\d+))?)((/[\\w\\d]*)*)/?$";
"^(https?://)?((([\\w\\d-]+)(\\.[\\w\\d-]+)*)(:(\\d+))?)((/[\\w\\d\\.-]*)*)/?$";

private final String url;

Expand All @@ -33,7 +33,7 @@ public static OAuthURL from(final String urlStr) {
Matcher matcher = pattern.matcher(urlStr.trim().toLowerCase());

if (!matcher.find()) {
throw SnowflakeErrors.ERROR_0007.getException("input url: " + urlStr);
throw SnowflakeErrors.ERROR_0033.getException("input url: " + urlStr);
}

boolean ssl = !"http://".equals(matcher.group(1));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ public enum SnowflakeErrors {
"Check Snowflake Kafka Connector docs for details"),
ERROR_0033(
"0033",
"Invalid OAuth URL",
"OAuth URL format: '[http://|https://]<oauth_server>[:<port>][/<path>]'. Protocol defaults"
+ " to 'https://'. Port defaults to 443 for https and 80 for http. Path may contain"
+ " alphanumeric characters, dots, hyphens, and forward slashes (e.g.,"
+ " 'login.example.com/oauth2/v2.0/token')."),
ERROR_0034(
Copy link
Contributor Author

@sfc-gh-wtrefon sfc-gh-wtrefon Oct 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this one hasn't been used yet so i moved it from 0033 -> 0034

"0034",
"Iceberg ingestion not supported by Snowpipe Streaming v2",
"Use Snowpipe Streaming v1 instead"),
// Snowflake connection issues 1---
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,13 @@ static Stream<Arguments> correctUrls() {
List.of("https", "localhost:8085", "/push/token", true)),
Arguments.of("localhost:8085", List.of("https", "localhost:8085", "", true)),
Arguments.of("http://localhost:8085", List.of("http", "localhost:8085", "", false)),
Arguments.of("localhost", List.of("https", "localhost:443", "", true)));
Arguments.of("localhost", List.of("https", "localhost:443", "", true)),
Arguments.of(
"https://login.test.com/xxxxxxx/oauth2/v2.0/token",
List.of("https", "login.test.com:443", "/xxxxxxx/oauth2/v2.0/token", true)),
Arguments.of(
"https://example.com/my-api/v2.0/get-token",
List.of("https", "example.com:443", "/my-api/v2.0/get-token", true)));
}

@ParameterizedTest(name = "url: {0}, parsed: {1}")
Expand Down
Loading