Skip to content

Commit f29c41e

Browse files
committed
Emit deprecation warning log
Signed-off-by: Robert Young <[email protected]>
1 parent 2b70a75 commit f29c41e

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

kroxylicious-runtime/src/main/java/io/kroxylicious/proxy/internal/FilterHandler.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import java.util.concurrent.CompletableFuture;
1313
import java.util.concurrent.CompletionStage;
1414
import java.util.concurrent.TimeUnit;
15+
import java.util.concurrent.atomic.AtomicBoolean;
1516

1617
import org.apache.kafka.common.Uuid;
1718
import org.apache.kafka.common.message.ProduceRequestData;
@@ -75,6 +76,7 @@ public class FilterHandler extends ChannelDuplexHandler {
7576
private CompletableFuture<Void> readFuture = CompletableFuture.completedFuture(null);
7677
private @Nullable ChannelHandlerContext ctx;
7778
private @Nullable PromiseFactory promiseFactory;
79+
private static AtomicBoolean deprecationWarningEmitted = new AtomicBoolean(false);
7880

7981
public FilterHandler(FilterAndInvoker filterAndInvoker,
8082
long timeoutMs,
@@ -521,6 +523,13 @@ public Optional<ClientTlsContext> clientTlsContext() {
521523
@Override
522524
public void clientSaslAuthenticationSuccess(String mechanism,
523525
String authorizedId) {
526+
if (deprecationWarningEmitted.compareAndSet(false, true)) {
527+
LOGGER.warn("Deprecated clientSaslAuthenticationSuccess(String mechanism, String authorizedId) was invoked by filter '{}'. Instead call "
528+
+ "clientSaslAuthenticationSuccess(String mechanism, Subject subject), ensuring that the Subject contains a {} principal with "
529+
+ "name equal to authorizedId",
530+
filterAndInvoker.filterName(),
531+
User.class.getName());
532+
}
524533
clientSaslAuthenticationSuccess(mechanism, new Subject(Set.of(new User(authorizedId))));
525534
}
526535

0 commit comments

Comments
 (0)