Skip to content

Commit

Permalink
Add the constant for defaut service in create obo endpoint
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Liang <jiallian@amazon.com>
  • Loading branch information
RyanL1997 committed Aug 24, 2023
1 parent 477b505 commit 4841b25
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ public class CreateOnBehalfOfTokenAction extends BaseRestHandler {
public static final Integer OBO_DEFAULT_EXPIRY_SECONDS = 5 * 60;
public static final Integer OBO_MAX_EXPIRY_SECONDS = 10 * 60;

public static final String DEFAULT_SERVICE = "self-issued";

@Subscribe
public void onConfigModelChanged(ConfigModel configModel) {
this.configModel = configModel;
Expand Down Expand Up @@ -139,7 +141,7 @@ public void accept(RestChannel channel) throws Exception {
.map(value -> (Boolean) value)
.orElse(true); // Default to false if null

final String service = (String) requestBody.getOrDefault("service", "self-issued");
final String service = (String) requestBody.getOrDefault("service", DEFAULT_SERVICE);
final User user = threadPool.getThreadContext().getTransient(ConfigConstants.OPENDISTRO_SECURITY_USER);
Set<String> mappedRoles = mapRoles(user, /*Do not include host based mappings*/ null);

Expand Down

0 comments on commit 4841b25

Please sign in to comment.