Skip to content

Commit

Permalink
SHIBUI-2270
Browse files Browse the repository at this point in the history
expanding backend API and services supporting the API


Former-commit-id: 5e181da
  • Loading branch information
chasegawa committed Aug 19, 2022
1 parent 4fa6854 commit ba36424
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
package edu.internet2.tier.shibboleth.admin.ui.controller;

import edu.internet2.tier.shibboleth.admin.ui.domain.CustomEntityAttributeDefinition;
import edu.internet2.tier.shibboleth.admin.ui.domain.shib.properties.ShibPropertySet;
import edu.internet2.tier.shibboleth.admin.ui.exception.EntityNotFoundException;
import edu.internet2.tier.shibboleth.admin.ui.exception.ObjectIdExistsException;
import edu.internet2.tier.shibboleth.admin.ui.service.ShibConfigurationService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.tags.Tags;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.annotation.Secured;
Expand All @@ -21,9 +20,6 @@
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;

import java.util.List;

@RestController
@RequestMapping(value = "/api/shib")
Expand All @@ -34,6 +30,8 @@ public class ShibPropertiesController {

@GetMapping("/properties")
@Transactional(readOnly = true)
@Operation(description = "Return all the configuration properties - used to populate the UI with the know configuration properties",
summary = "Return all the configuration properties - used to populate the UI with the know configuration properties", method = "GET")
public ResponseEntity<?> getAllConfigurationProperties() {
return ResponseEntity.ok(service.getAllConfigurationProperties());
}
Expand All @@ -43,12 +41,16 @@ public ResponseEntity<?> getAllConfigurationProperties() {
*/
@GetMapping("/property/set")
@Transactional(readOnly = true)
@Operation(description = "Return a list of all the set names and their resourceId",
summary = "Return a list of all the set names and their resourceId", method = "GET")
public ResponseEntity<?> getAllPropertySets() {
return ResponseEntity.ok(service.getAllPropertySets());
}

@GetMapping("/property/set/{resourceId}")
@Transactional(readOnly = true)
@Operation(description = "Return the property set with the given resourceId",
summary = "Return the property set with the given resourceId", method = "GET")
public ResponseEntity<?> getPropertySet(@PathVariable Integer resourceId) throws EntityNotFoundException {
return ResponseEntity.ok(service.getSet(resourceId));
}
Expand All @@ -64,6 +66,8 @@ public ResponseEntity<?> deletePropertySet(@PathVariable Integer resourceId) thr
@PostMapping("/property/set")
@Secured("ROLE_ADMIN")
@Transactional
@Operation(description = "Create a property set with all new information - must not be an existing set",
summary = "Create a property set with all new information - must not be an existing set", method = "POST")
public ResponseEntity<?> createPropertySet(@RequestBody ShibPropertySet newSet) throws ObjectIdExistsException {
ShibPropertySet result = service.create(newSet);
return ResponseEntity.status(HttpStatus.CREATED).body(result);
Expand All @@ -72,6 +76,8 @@ public ResponseEntity<?> createPropertySet(@RequestBody ShibPropertySet newSet)
@PutMapping("/property/set/{resourceId}")
@Secured("ROLE_ADMIN")
@Transactional
@Operation(description = "Update a property set with with the matching resourceId - must exist",
summary = "Update an existing property set with the matching resourceId - must exist", method = "PUT")
public ResponseEntity<?> updatePropertySet(@RequestBody ShibPropertySet setToUpdate, @PathVariable int resourceId) throws EntityNotFoundException {
ShibPropertySet result = service.update(setToUpdate);
return ResponseEntity.status(HttpStatus.OK).body(result);
Expand Down

0 comments on commit ba36424

Please sign in to comment.