diff --git a/client/trino-client/src/main/java/io/trino/client/auth/external/HttpTokenPoller.java b/client/trino-client/src/main/java/io/trino/client/auth/external/HttpTokenPoller.java index 5e53dac531a8..df079505b134 100644 --- a/client/trino-client/src/main/java/io/trino/client/auth/external/HttpTokenPoller.java +++ b/client/trino-client/src/main/java/io/trino/client/auth/external/HttpTokenPoller.java @@ -96,7 +96,7 @@ public void tokenReceived(URI tokenUri) .withMaxAttempts(-1) .withMaxDuration(Duration.ofSeconds(4)) .withBackoff(100, 500, MILLIS) - .handleResultIf(code -> code != HTTP_OK)) + .handleResultIf(code -> code >= 500)) .get(() -> { Request request = prepareRequestBuilder(tokenUri) .delete() diff --git a/core/trino-main/src/main/java/io/trino/server/security/oauth2/OAuth2TokenExchangeResource.java b/core/trino-main/src/main/java/io/trino/server/security/oauth2/OAuth2TokenExchangeResource.java index 6adadcbb5a43..37ba2f2e70dc 100644 --- a/core/trino-main/src/main/java/io/trino/server/security/oauth2/OAuth2TokenExchangeResource.java +++ b/core/trino-main/src/main/java/io/trino/server/security/oauth2/OAuth2TokenExchangeResource.java @@ -48,6 +48,7 @@ import static io.trino.server.security.oauth2.OAuth2TokenExchange.hashAuthId; import static java.util.Objects.requireNonNull; import static javax.ws.rs.core.MediaType.APPLICATION_JSON_TYPE; +import static javax.ws.rs.core.MediaType.TEXT_PLAIN_TYPE; @Path(OAuth2TokenExchangeResource.TOKEN_ENDPOINT) public class OAuth2TokenExchangeResource @@ -114,13 +115,15 @@ private static Response pendingResponse(HttpServletRequest request) @ResourceSecurity(PUBLIC) @DELETE @Path("{authId}") - public void deleteAuthenticationToken(@PathParam("authId") UUID authId) + public Response deleteAuthenticationToken(@PathParam("authId") UUID authId) { if (authId == null) { throw new BadRequestException(); } tokenExchange.dropToken(authId); + return Response.ok("Authentication deleted", TEXT_PLAIN_TYPE) + .build(); } public static String getTokenUri(UUID authId)