Skip to content

Commit

Permalink
Fix SchemaRegistryManager failure caused by apache/pulsar#19295
Browse files Browse the repository at this point in the history
  • Loading branch information
Demogorgon314 committed Mar 7, 2023
1 parent 5e96a19 commit aaf59af
Showing 1 changed file with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@
import java.util.Base64;
import java.util.Optional;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import javax.naming.AuthenticationException;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
Expand Down Expand Up @@ -99,8 +101,11 @@ public String authenticate(FullHttpRequest request) throws SchemaStorageExceptio
throw new SchemaStorageException("Pulsar is not configured for Token auth");
}
try {
AuthData authData = AuthData.of(password.getBytes(StandardCharsets.UTF_8));
final AuthenticationState authState = authenticationProvider
.newAuthState(AuthData.of(password.getBytes(StandardCharsets.UTF_8)), null, null);
.newAuthState(authData, null, null);
// TODO: Use the configurable timeout
authState.authenticateAsync(authData).get(10, TimeUnit.SECONDS);
final String role = authState.getAuthRole();

final String tenant;
Expand All @@ -118,7 +123,7 @@ public String authenticate(FullHttpRequest request) throws SchemaStorageExceptio

performAuthorizationValidation(username, role, tenant);
return tenant;
} catch (AuthenticationException err) {
} catch (ExecutionException | InterruptedException | TimeoutException | AuthenticationException err) {
throw new SchemaStorageException(err);
}

Expand Down

0 comments on commit aaf59af

Please sign in to comment.