eric-maynard commented on code in PR #1305: URL: https://github.com/apache/polaris/pull/1305#discussion_r2049959880
########## polaris-core/src/main/java/org/apache/polaris/core/secrets/UserSecretReference.java: ########## @@ -65,10 +70,28 @@ public class UserSecretReference { public UserSecretReference( @JsonProperty(value = "urn", required = true) @Nonnull String urn, @JsonProperty(value = "referencePayload") @Nullable Map<String, String> referencePayload) { + // TODO: Add better/standardized parsing and validation of URN syntax + Preconditions.checkArgument( + urn.startsWith("urn:polaris-secret:") && urn.split(":").length >= 4, + "Invalid secret URN '%s'; must be of the form " + + "'urn:polaris-secret:<secret-manager-type>:<type-specific-identifier>'", + urn); this.urn = urn; this.referencePayload = Objects.requireNonNullElse(referencePayload, new HashMap<>()); } + /** + * Since UserSecretReference objects are specific to UserSecretManager implementations, the + * "secret-manager-type" portion of the URN should be used to validate that a URN is valid for a + * given implementation and to dispatch to the correct implementation at runtime if multiple + * concurrent implementations are possible in a given runtime environment. + */ + @JsonIgnore + public String getUserSecretManagerTypeFromUrn() { + // TODO: Add better/standardized parsing and validation of URN syntax Review Comment: My understanding is the format won't change, but we will just make the parsing / validation more structured -- that's cool with me -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@polaris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org