pvillard31 commented on code in PR #10567:
URL: https://github.com/apache/nifi/pull/10567#discussion_r2571647860
##########
nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-service-shared/src/main/java/org/apache/nifi/kafka/service/security/OAuthBearerLoginCallbackHandler.java:
##########
@@ -72,20 +82,32 @@ public void configure(final Map<String, ?> configs, final
String saslMechanism,
this.accessTokenProvider = accessTokenProvider;
this.accessTokenValidator = new ClientJwtValidator();
this.accessTokenValidator.configure(configs, saslMechanism, List.of());
+
+ this.saslExtensions = options.entrySet().stream()
+ .filter(entry -> isSaslExtensionProperty(entry.getKey()))
+ .collect(Collectors.collectingAndThen(
+ Collectors.toMap(entry ->
removeSaslExtensionPropertyPrefix(entry.getKey()), entry ->
entry.getValue().toString()),
+ Collections::unmodifiableMap));
}
@Override
- public void handle(final Callback[] callbacks) {
+ public void handle(final Callback[] callbacks) throws
UnsupportedCallbackException {
for (final Callback callback : callbacks) {
if (callback instanceof OAuthBearerTokenCallback) {
handleTokenCallback((OAuthBearerTokenCallback) callback);
+ } else if (callback instanceof SaslExtensionsCallback) {
+ handleExtensionsCallback((SaslExtensionsCallback) callback);
+ } else {
+ throw new UnsupportedCallbackException(callback);
}
}
}
Review Comment:
To be honest, I have no idea if that could even happen. I was just wondering
just by reading the code. But yeah, this is good point that if the Kafka code
is doing the same, it is safe for us to have the same approach. I'm totally
fine with this then. Thanks!
--
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]