Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce 419 AuthenticationTimeoutResponse instead of using 401 UnauthorizedResponse on token expiration #791

Open
sungwy opened this issue Jan 16, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@sungwy
Copy link

sungwy commented Jan 16, 2025

Describe the bug

Iceberg clients rely on the distinction between status code values to refresh the token when AuthenticationTimeoutResponse is issued for expired tokens.

Currently, polaris returns a 401 UnauthorizedResponse which isn't conformant to the REST Catalog Spec.

public void testTokenExpiry() {
// TokenExpiredException - if the token has expired.
String newToken =
defaultJwt()
.withExpiresAt(Instant.now().plus(1, ChronoUnit.SECONDS))
.sign(Algorithm.HMAC256("polaris"));
Awaitility.await("expected list of records should be produced")
.atMost(Duration.ofSeconds(20))
.pollDelay(Duration.ofSeconds(1))
.pollInterval(Duration.ofSeconds(1))
.untilAsserted(
() -> {
try (Response response =
client.managementApi(newToken).request("v1/principals").get()) {
assertThat(response)
.returns(Response.Status.UNAUTHORIZED.getStatusCode(), Response::getStatus);
}
});
}

To Reproduce

Use an expired token to make a request against polaris catalog

Actual Behavior

Currently, polaris returns a 401 UnauthorizedResponse which isn't conformant to the REST Catalog Spec.

Expected Behavior

419 AuthenticationTimeoutResponse should be returned

Additional context

No response

System information

No response

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant