Skip to content

Commit

Permalink
Add permission obo/create for accessing 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 22, 2023
1 parent 2349213 commit 9103b23
Showing 1 changed file with 14 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.opensearch.core.xcontent.XContentBuilder;
import org.opensearch.rest.BaseRestHandler;
import org.opensearch.rest.BytesRestResponse;
import org.opensearch.rest.NamedRoute;
import org.opensearch.rest.RestChannel;
import org.opensearch.rest.RestRequest;
import org.opensearch.rest.RestRequest.Method;
Expand All @@ -39,10 +40,21 @@
import org.opensearch.security.user.User;
import org.opensearch.threadpool.ThreadPool;

import static org.opensearch.rest.RestRequest.Method.POST;
import static org.opensearch.security.dlic.rest.support.Utils.addRoutesPrefix;

public class CreateOnBehalfOfTokenAction extends BaseRestHandler {

private static final List<Route> routes = addRoutesPrefix(
ImmutableList.of(
new NamedRoute.Builder().method(POST)
.path("/user/onbehalfof")
.uniqueName("security:obo/create")
.build()
),
"/_plugins/_security/api"
);

private JwtVendor vendor;
private final ThreadPool threadPool;
private final ClusterService clusterService;
Expand Down Expand Up @@ -85,9 +97,9 @@ public String getName() {

@Override
public List<Route> routes() {
return addRoutesPrefix(ImmutableList.of(new Route(Method.POST, "/user/onbehalfof")));
return routes;
}

@Override
protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) throws IOException {
switch (request.method()) {
Expand Down

0 comments on commit 9103b23

Please sign in to comment.