fivetran-arunsuri commented on code in PR #2197: URL: https://github.com/apache/polaris/pull/2197#discussion_r2271159095
########## integration-tests/src/main/java/org/apache/polaris/service/it/test/PolarisManagementServiceIntegrationTest.java: ########## @@ -873,6 +873,53 @@ public void testCreatePrincipalAndRotateCredentials() { // rotation that makes the old secret fall off retention. } + @Test + public void testCreatePrincipalAndResetCredentialsWithCustomValues() { + // Create a new principal using root user + Principal principal = + Principal.builder() + .setName(client.newEntityName("myprincipal-reset")) + .setProperties(Map.of("custom-tag", "bar")) + .build(); + + PrincipalWithCredentials creds = + managementApi.createPrincipal(new CreatePrincipalRequest(principal, true)); + + Map<String, String> customBody = + Map.of( + "clientId", "f174b76a7e1a99e2", + "clientSecret", "27029d236abc08e204922b0a07031bc2"); + + PrincipalWithCredentials resetCreds; + try (Response response = + managementApi + .request("v1/principals/{p}/reset", Map.of("p", principal.getName())) + .post(Entity.json(customBody))) { + + assertThat(response).returns(Response.Status.OK.getStatusCode(), Response::getStatus); + resetCreds = response.readEntity(PrincipalWithCredentials.class); + } + + assertThat(resetCreds.getCredentials().getClientId()).isEqualTo("f174b76a7e1a99e2"); + assertThat(resetCreds.getCredentials().getClientSecret()) + .isEqualTo("27029d236abc08e204922b0a07031bc2"); + + // Principal itself tries to reset with custom creds → should fail (403 Forbidden) + String principalToken = client.obtainToken(resetCreds); + customBody = + Map.of( + "clientId", "f174b76a7e1a99e3", + "clientSecret", "27029d236abc08e204922b0a07031bc3"); Review Comment: The creds are diff though, may look similar 🤔 -- 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