Skip to content

Commit

Permalink
Some minor refactoring in obo authenticator
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Liang <[email protected]>
  • Loading branch information
RyanL1997 committed Aug 22, 2023
1 parent 6f0e79b commit 72dcec1
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ public class OnBehalfOfAuthenticator implements HTTPAuthenticator {
private final EncryptionDecryptionUtil encryptionUtil;

public OnBehalfOfAuthenticator(Settings settings, String clusterName) {
String oboEnabledSetting = settings.get("enabled");
oboEnabled = oboEnabledSetting == null ? Boolean.TRUE : Boolean.valueOf(oboEnabledSetting);
String oboEnabledSetting = settings.get("enabled", "true");
oboEnabled = Boolean.parseBoolean(oboEnabledSetting);
encryptionKey = settings.get("encryption_key");
jwtParser = initParser(settings.get("signing_key"));
this.clusterName = clusterName;
Expand Down Expand Up @@ -151,7 +151,7 @@ private AuthCredentials extractCredentials0(final RestRequest request) {
return null;
}

if (!isAllowedRequest(request)) {
if (!isRequestAllowed(request)) {
return null;
}

Expand Down Expand Up @@ -226,7 +226,7 @@ private void logDebug(String message, Object... args) {
}
}

public Boolean isAllowedRequest(final RestRequest request) {
public Boolean isRequestAllowed(final RestRequest request) {
Matcher matcher = PATTERN_PATH_PREFIX.matcher(request.path());
final String suffix = matcher.matches() ? matcher.group(2) : null;
if (request.method() == RestRequest.Method.POST && ON_BEHALF_OF_SUFFIX.equals(suffix)
Expand Down

0 comments on commit 72dcec1

Please sign in to comment.