|
11 | 11 |
|
12 | 12 | package com.suse.manager.hub;
|
13 | 13 |
|
14 |
| -import static com.suse.manager.hub.HubSparkHelper.allowingOnlyHub; |
15 |
| -import static com.suse.manager.hub.HubSparkHelper.allowingOnlyRegistered; |
16 |
| -import static com.suse.manager.hub.HubSparkHelper.allowingOnlyUnregistered; |
| 14 | +import static com.suse.manager.hub.HubSparkHelper.onlyFromHub; |
| 15 | +import static com.suse.manager.hub.HubSparkHelper.onlyFromRegistered; |
| 16 | +import static com.suse.manager.hub.HubSparkHelper.onlyFromUnregistered; |
17 | 17 | import static com.suse.manager.hub.HubSparkHelper.usingTokenAuthentication;
|
18 | 18 | import static com.suse.manager.webui.utils.SparkApplicationHelper.asJson;
|
19 | 19 | import static com.suse.manager.webui.utils.SparkApplicationHelper.badRequest;
|
@@ -90,26 +90,26 @@ public HubController(HubManager hubManagerIn) {
|
90 | 90 | */
|
91 | 91 | public void initRoutes() {
|
92 | 92 | post("/hub/ping", asJson(usingTokenAuthentication(this::ping)));
|
93 |
| - post("/hub/sync/deregister", asJson(usingTokenAuthentication(allowingOnlyRegistered(this::deregister)))); |
94 |
| - post("/hub/sync/registerHub", asJson(usingTokenAuthentication(allowingOnlyUnregistered(this::registerHub)))); |
95 |
| - post("/hub/sync/replaceTokens", asJson(usingTokenAuthentication(allowingOnlyHub(this::replaceTokens)))); |
96 |
| - post("/hub/sync/storeCredentials", asJson(usingTokenAuthentication(allowingOnlyHub(this::storeCredentials)))); |
97 |
| - post("/hub/sync/setHubDetails", asJson(usingTokenAuthentication(allowingOnlyHub(this::setHubDetails)))); |
98 |
| - get("/hub/managerinfo", asJson(usingTokenAuthentication(allowingOnlyHub(this::getManagerInfo)))); |
| 93 | + post("/hub/sync/deregister", asJson(usingTokenAuthentication(onlyFromRegistered(this::deregister)))); |
| 94 | + post("/hub/sync/registerHub", asJson(usingTokenAuthentication(onlyFromUnregistered(this::registerHub)))); |
| 95 | + post("/hub/sync/replaceTokens", asJson(usingTokenAuthentication(onlyFromHub(this::replaceTokens)))); |
| 96 | + post("/hub/sync/storeCredentials", asJson(usingTokenAuthentication(onlyFromHub(this::storeCredentials)))); |
| 97 | + post("/hub/sync/setHubDetails", asJson(usingTokenAuthentication(onlyFromHub(this::setHubDetails)))); |
| 98 | + get("/hub/managerinfo", asJson(usingTokenAuthentication(onlyFromHub(this::getManagerInfo)))); |
99 | 99 | post("/hub/storeReportDbCredentials",
|
100 |
| - asJson(usingTokenAuthentication(allowingOnlyHub(this::setReportDbCredentials)))); |
| 100 | + asJson(usingTokenAuthentication(onlyFromHub(this::setReportDbCredentials)))); |
101 | 101 | post("/hub/removeReportDbCredentials",
|
102 |
| - asJson(usingTokenAuthentication(allowingOnlyHub(this::removeReportDbCredentials)))); |
| 102 | + asJson(usingTokenAuthentication(onlyFromHub(this::removeReportDbCredentials)))); |
103 | 103 | get("/hub/listAllPeripheralOrgs",
|
104 |
| - asJson(usingTokenAuthentication(allowingOnlyHub(this::listAllPeripheralOrgs)))); |
| 104 | + asJson(usingTokenAuthentication(onlyFromHub(this::listAllPeripheralOrgs)))); |
105 | 105 | get("/hub/listAllPeripheralChannels",
|
106 |
| - asJson(usingTokenAuthentication(allowingOnlyHub(this::listAllPeripheralChannels)))); |
| 106 | + asJson(usingTokenAuthentication(onlyFromHub(this::listAllPeripheralChannels)))); |
107 | 107 | post("/hub/addVendorChannels",
|
108 |
| - asJson(usingTokenAuthentication(allowingOnlyHub(this::addVendorChannels)))); |
| 108 | + asJson(usingTokenAuthentication(onlyFromHub(this::addVendorChannels)))); |
109 | 109 | post("/hub/addCustomChannels",
|
110 |
| - asJson(usingTokenAuthentication(allowingOnlyHub(this::addCustomChannels)))); |
| 110 | + asJson(usingTokenAuthentication(onlyFromHub(this::addCustomChannels)))); |
111 | 111 | post("/hub/modifyCustomChannels",
|
112 |
| - asJson(usingTokenAuthentication(allowingOnlyHub(this::modifyCustomChannels)))); |
| 112 | + asJson(usingTokenAuthentication(onlyFromHub(this::modifyCustomChannels)))); |
113 | 113 | }
|
114 | 114 |
|
115 | 115 | private String setHubDetails(Request request, Response response, IssAccessToken accessToken) {
|
|
0 commit comments