Skip to content

Commit 8e4715c

Browse files
authored
add security (#177)
* fix path to category suggestions * ability to refresh hosting envs * add hosting event type * add config option requests * Security
1 parent 8e0a414 commit 8e4715c

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/main/java/com/redhat/labs/lodestar/resource/ConfigResource.java

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
import javax.ws.rs.core.MediaType;
1414
import javax.ws.rs.core.Response;
1515

16-
import org.eclipse.microprofile.jwt.JsonWebToken;
1716
import org.eclipse.microprofile.openapi.annotations.Operation;
1817
import org.eclipse.microprofile.openapi.annotations.responses.APIResponse;
1918
import org.eclipse.microprofile.openapi.annotations.responses.APIResponses;
@@ -31,14 +30,11 @@
3130
public class ConfigResource {
3231
private static final Logger LOGGER = LoggerFactory.getLogger(ConfigResource.class);
3332

34-
@Inject
35-
JsonWebToken jwt;
36-
3733
@Inject
3834
ConfigService configService;
3935

4036
@GET
41-
@SecurityRequirement(name = "jwt", scopes = {})
37+
@SecurityRequirement(name = "jwt")
4238
@APIResponses(value = { @APIResponse(responseCode = "401", description = "Missing or Invalid JWT"),
4339
@APIResponse(responseCode = "200", description = "Configuration file data has been returned.") })
4440
@Operation(summary = "Returns configuration file data.")
@@ -49,7 +45,7 @@ public Response fetchConfigData(@QueryParam("type") Optional<String> type) {
4945

5046
@PUT
5147
@Path("/rbac/cache")
52-
@SecurityRequirement(name = "jwt", scopes = {})
48+
@SecurityRequirement(name = "jwt")
5349
@APIResponses(value = { @APIResponse(responseCode = "401", description = "Missing or Invalid JWT"),
5450
@APIResponse(responseCode = "200", description = "Cache invalidated.") })
5551
public Response invalidateRbacCache() {
@@ -59,18 +55,30 @@ public Response invalidateRbacCache() {
5955

6056
@GET
6157
@Path("artifact/options")
58+
@SecurityRequirement(name = "jwt")
59+
@APIResponses(value = { @APIResponse(responseCode = "401", description = "Missing or Invalid JWT"),
60+
@APIResponse(responseCode = "200", description = "Artifact ptions success.") })
61+
@Operation(summary = "Returns a map of key value pairs or artifact option.")
6262
public Map<String, String> getArtifactOptions() {
6363
return configService.getArtifactOptions();
6464
}
6565

6666
@GET
6767
@Path("engagement/options")
68+
@SecurityRequirement(name = "jwt")
69+
@APIResponses(value = { @APIResponse(responseCode = "401", description = "Missing or Invalid JWT"),
70+
@APIResponse(responseCode = "200", description = "Engagement options success.") })
71+
@Operation(summary = "Returns a map of key value pairs or engagement option.")
6872
public Map<String, String> getEngagementOptions() {
6973
return configService.getEngagementOptions();
7074
}
7175

7276
@GET
7377
@Path("region/options")
78+
@SecurityRequirement(name = "jwt")
79+
@APIResponses(value = { @APIResponse(responseCode = "401", description = "Missing or Invalid JWT"),
80+
@APIResponse(responseCode = "200", description = "Region options success.") })
81+
@Operation(summary = "Returns a map of key value pairs or region option.")
7482
public Map<String, String> getRegionOptions() {
7583
return configService.getRegionOptions();
7684
}

0 commit comments

Comments
 (0)