|
28 | 28 | import org.opensearch.core.xcontent.XContentBuilder; |
29 | 29 | import org.opensearch.rest.BaseRestHandler; |
30 | 30 | import org.opensearch.rest.BytesRestResponse; |
| 31 | +import org.opensearch.rest.NamedRoute; |
31 | 32 | import org.opensearch.rest.RestChannel; |
32 | 33 | import org.opensearch.rest.RestRequest; |
33 | 34 | import org.opensearch.rest.RestRequest.Method; |
|
39 | 40 | import org.opensearch.security.user.User; |
40 | 41 | import org.opensearch.threadpool.ThreadPool; |
41 | 42 |
|
| 43 | +import static org.opensearch.rest.RestRequest.Method.POST; |
42 | 44 | import static org.opensearch.security.dlic.rest.support.Utils.addRoutesPrefix; |
43 | 45 |
|
44 | 46 | public class CreateOnBehalfOfTokenAction extends BaseRestHandler { |
45 | 47 |
|
| 48 | + private static final List<Route> routes = addRoutesPrefix( |
| 49 | + ImmutableList.of( |
| 50 | + new NamedRoute.Builder().method(POST) |
| 51 | + .path("/user/onbehalfof") |
| 52 | + .uniqueName("security:obo/create") |
| 53 | + .build() |
| 54 | + ), |
| 55 | + "/_plugins/_security/api" |
| 56 | + ); |
| 57 | + |
46 | 58 | private JwtVendor vendor; |
47 | 59 | private final ThreadPool threadPool; |
48 | 60 | private final ClusterService clusterService; |
@@ -85,9 +97,9 @@ public String getName() { |
85 | 97 |
|
86 | 98 | @Override |
87 | 99 | public List<Route> routes() { |
88 | | - return addRoutesPrefix(ImmutableList.of(new Route(Method.POST, "/user/onbehalfof"))); |
| 100 | + return routes; |
89 | 101 | } |
90 | | - |
| 102 | + |
91 | 103 | @Override |
92 | 104 | protected RestChannelConsumer prepareRequest(RestRequest request, NodeClient client) throws IOException { |
93 | 105 | switch (request.method()) { |
|
0 commit comments