Skip to content

Commit

Permalink
#2616 Spotless Apply
Browse files Browse the repository at this point in the history
Signed-off-by: Sam <[email protected]>
  • Loading branch information
samuelcostae committed Jul 5, 2023
1 parent eb54ee9 commit a39fcad
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1908,12 +1908,7 @@ public Subject getSubject() {

@Override
public TokenManager getTokenManager() {
return new SecurityTokenManager(
threadPool,
new XFFResolver(threadPool),
auditLog,
settings
);
return new SecurityTokenManager(threadPool, new XFFResolver(threadPool), auditLog, settings);
}

public static class GuiceHolder implements LifecycleComponent {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import org.greenrobot.eventbus.Subscribe;
import org.opensearch.common.settings.Settings;
import org.opensearch.common.transport.TransportAddress;
import org.opensearch.common.util.concurrent.ThreadContext;
import org.opensearch.common.util.set.Sets;
import org.opensearch.identity.tokens.AuthToken;
import org.opensearch.identity.tokens.BasicAuthToken;
Expand All @@ -23,7 +22,8 @@
import org.opensearch.security.user.User;
import org.opensearch.threadpool.ThreadPool;

import java.util.*;
import java.util.Set;
import java.util.StringJoiner;

public class SecurityTokenManager implements TokenManager {

Expand All @@ -38,14 +38,12 @@ public void onConfigModelChanged(ConfigModel configModel) {
this.configModel = configModel;
}

public SecurityTokenManager(
ThreadPool threadPool,
final XFFResolver xffResolver,
AuditLog auditLog,
Settings settings
) {
public SecurityTokenManager(ThreadPool threadPool, final XFFResolver xffResolver, AuditLog auditLog, Settings settings) {
this.userInjector = new UserInjector(settings, threadPool, auditLog, xffResolver);
this.extensionBwcCompatMode = settings.getAsBoolean(ConfigConstants.EXTENSIONS_BWC_PLUGIN_MODE, ConfigConstants.EXTENSIONS_BWC_PLUGIN_MODE_DEFAULT);
this.extensionBwcCompatMode = settings.getAsBoolean(
ConfigConstants.EXTENSIONS_BWC_PLUGIN_MODE,
ConfigConstants.EXTENSIONS_BWC_PLUGIN_MODE_DEFAULT
);
this.user = threadPool.getThreadContext().getTransient(ConfigConstants.OPENDISTRO_SECURITY_USER);
final TransportAddress caller = threadPool.getThreadContext().getTransient(ConfigConstants.OPENDISTRO_SECURITY_REMOTE_ADDRESS);

Expand All @@ -63,7 +61,7 @@ public AuthToken issueToken(String audience) {
joiner.add(String.join(",", user.getRoles()));
joiner.add(String.join(",", Sets.union(user.getSecurityRoles(), mappedRoles)));

return new BasicAuthToken(joiner.toString() + "This is the Token including the encrypted backend roles");
return new BasicAuthToken(joiner + "This is the Token including the encrypted backend roles");
} else {
return new BasicAuthToken("This is standard Token without the roles");
}
Expand Down

0 comments on commit a39fcad

Please sign in to comment.