Skip to content

Commit

Permalink
SHIBUI-1946
Browse files Browse the repository at this point in the history
Added a flag so that the front end would get the list of custom entity
attribute definitions AND the list of RelyingPartyOverrideProperties
(from any config file) together and be able to differentiate which ones
from the DB and which were from a file.
  • Loading branch information
chasegawa committed Jun 10, 2021
1 parent 0f90717 commit 8bb03ef
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package edu.internet2.tier.shibboleth.admin.ui.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
Expand All @@ -17,15 +15,18 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.support.ServletUriComponentsBuilder;

import edu.internet2.tier.shibboleth.admin.ui.configuration.CustomPropertiesConfiguration;
import edu.internet2.tier.shibboleth.admin.ui.domain.CustomEntityAttributeDefinition;
import edu.internet2.tier.shibboleth.admin.ui.domain.EntityDescriptor;
import edu.internet2.tier.shibboleth.admin.ui.service.CustomEntityAttributesDefinitionService;

@Controller
@RequestMapping(value = "/api/custom/entity")
public class CustomEntityAttributesDefinitionsController {
@Autowired
private CustomEntityAttributesDefinitionService caService;

@Autowired
private CustomPropertiesConfiguration customPropertiesConfiguration;

@PostMapping("/attribute")
@Transactional
Expand Down Expand Up @@ -63,10 +64,14 @@ public ResponseEntity<?> update(@RequestBody CustomEntityAttributeDefinition def
return ResponseEntity.ok(result);
}

/**
* @return List of IRelyingPartyOverrideProperty objects. This will include all of the CustomEntityAttributeDefinition
* and the RelyingPartyOverrideProperties from any configuration file that was read in at startup.
*/
@GetMapping("/attributes")
@Transactional(readOnly = true)
public ResponseEntity<?> getAll() {
return ResponseEntity.ok(caService.getAllDefinitions());
return ResponseEntity.ok(customPropertiesConfiguration.getOverrides());
}

@GetMapping("/attribute/{name}")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,11 @@ public Set<String> getDefaultValues() {
return customAttrListDefinitions;
}

@Override
public Boolean getFromConfigFile() {
return Boolean.FALSE;
}

@Override
public String getPersistType() {
return attributeType.toString();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ public interface IRelyingPartyOverrideProperty {

public String getDisplayType();

public Boolean getFromConfigFile();

public String getHelpText();

public String getInvert();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,9 @@ public class RelyingPartyOverrideProperty implements IRelyingPartyOverrideProper
private String name;
private String persistType;
private String persistValue;

@Override
public Boolean getFromConfigFile() {
return Boolean.TRUE;
}
}

0 comments on commit 8bb03ef

Please sign in to comment.