mneethiraj commented on code in PR #1227:
URL: https://github.com/apache/ranger/pull/1227#discussion_r4007416275
##########
agents-common/src/main/java/org/apache/ranger/plugin/policyengine/RangerPluginContext.java:
##########
@@ -196,4 +198,61 @@ void cleanResourceMatchers() {
LOG.debug("<== cleanResourceMatchers()");
}
+
+ private static Supplier<String> getTokenSupplier(String propertyPrefix,
RangerPluginConfig config) {
+ String providerProp = propertyPrefix +
DefaultTokenSupplier.JWT_SUPPLIER;
+ String clzName = config.get(providerProp);
+ Supplier<String> ret = null;
+
+ if (StringUtils.isNotBlank(clzName) &&
!DefaultTokenSupplier.class.getName().equals(clzName)) {
Review Comment:
I suggest replacing 205 to 221 with the following - for simplification:
```
final Supplier<String> ret;
if (StringUtils.isNotBlank(clzName)) {
LOG.info("Using Token supplier [{}], config: [{}]", clzName, providerProp);
if (DefaultTokenSupplier.class.getName().equals(clzName)) {
ret = new DefaultTokenSupplier(propertyPrefix, config);
} else {
ret = getCustomTokenSupplier(clzName, config, providerProp);
}
} else if (isJwtSourceConfigured(propertyPrefix, config)) {
ret = new DefaultTokenSupplier(propertyPrefix, config);
} else {
LOG.debug("No token supplier configured, config: [{}]", providerProp);
ret = null;
}
```
--
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]