adutra commented on code in PR #623:
URL: https://github.com/apache/polaris/pull/623#discussion_r1907731657
##########
dropwizard/service/src/main/java/org/apache/polaris/service/dropwizard/PolarisApplication.java:
##########
@@ -478,6 +479,52 @@ private static OpenTelemetry setupTracing() {
.build();
}
+ @jakarta.ws.rs.ext.Provider
+ @Priority(Priorities.AUTHENTICATION)
+ private static class PolarisPrincipalAuthenticator implements
ContainerRequestFilter {
+ @Inject private Authenticator<String, AuthenticatedPolarisPrincipal>
authenticator;
+
+ @Override
+ public void filter(ContainerRequestContext requestContext) throws
IOException {
+ String authHeader = requestContext.getHeaderString("Authorization");
+ if (authHeader == null) {
+ throw new IOException("Authorization header is missing");
+ }
+ int spaceIdx = authHeader.indexOf(' ');
+ if (spaceIdx <= 0 || !authHeader.substring(0,
spaceIdx).equalsIgnoreCase("Bearer")) {
+ throw new IOException("Authorization header is not a Bearer token");
Review Comment:
Same: why not `NotAuthorizedException`?
##########
dropwizard/service/src/main/java/org/apache/polaris/service/dropwizard/PolarisApplication.java:
##########
@@ -478,6 +479,52 @@ private static OpenTelemetry setupTracing() {
.build();
}
+ @jakarta.ws.rs.ext.Provider
+ @Priority(Priorities.AUTHENTICATION)
+ private static class PolarisPrincipalAuthenticator implements
ContainerRequestFilter {
+ @Inject private Authenticator<String, AuthenticatedPolarisPrincipal>
authenticator;
+
+ @Override
+ public void filter(ContainerRequestContext requestContext) throws
IOException {
+ String authHeader = requestContext.getHeaderString("Authorization");
+ if (authHeader == null) {
+ throw new IOException("Authorization header is missing");
Review Comment:
Why not `NotAuthorizedException`?
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]