-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Midstream work checkin (tests broken)
- Loading branch information
Showing
8 changed files
with
177 additions
and
79 deletions.
There are no files selected for viewing
54 changes: 44 additions & 10 deletions
54
...a/edu/internet2/tier/shibboleth/admin/ui/configuration/CustomPropertiesConfiguration.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,36 +1,70 @@ | ||
| package edu.internet2.tier.shibboleth.admin.ui.configuration; | ||
|
|
||
| import edu.internet2.tier.shibboleth.admin.ui.domain.IRelyingPartyOverrideProperty; | ||
| import edu.internet2.tier.shibboleth.admin.ui.domain.RelyingPartyOverrideProperty; | ||
| import edu.internet2.tier.shibboleth.admin.ui.service.CustomEntityAttributesDefinitionService; | ||
|
|
||
| import org.springframework.beans.factory.annotation.Autowired; | ||
| import org.springframework.boot.context.properties.ConfigurationProperties; | ||
| import org.springframework.context.annotation.Bean; | ||
| import org.springframework.context.annotation.Configuration; | ||
|
|
||
| import java.util.ArrayList; | ||
| import java.util.HashMap; | ||
| import java.util.List; | ||
| import java.util.Map; | ||
|
|
||
| /** | ||
| * @author Bill Smith (wsmith@unicon.net) | ||
| */ | ||
| import javax.annotation.PostConstruct; | ||
|
|
||
| @Configuration | ||
| @ConfigurationProperties(prefix="custom") | ||
| @ConfigurationProperties(prefix = "custom") | ||
| public class CustomPropertiesConfiguration { | ||
|
|
||
| private List<? extends Map<String, String>> attributes = new ArrayList<>(); | ||
| private List<RelyingPartyOverrideProperty> overrides = new ArrayList<>(); | ||
|
|
||
| private CustomEntityAttributesDefinitionService ceadService; | ||
|
|
||
| private HashMap<String, IRelyingPartyOverrideProperty> overrides = new HashMap<>(); | ||
|
|
||
| private List<RelyingPartyOverrideProperty> overridesFromConfigFile = new ArrayList<>(); | ||
|
|
||
| public List<? extends Map<String, String>> getAttributes() { | ||
| return attributes; | ||
| } | ||
|
|
||
| public List<IRelyingPartyOverrideProperty> getOverrides() { | ||
| return new ArrayList<>(overrides.values()); | ||
| } | ||
|
|
||
| public void setAttributes(List<? extends Map<String, String>> attributes) { | ||
| this.attributes = attributes; | ||
| } | ||
|
|
||
| @Autowired | ||
| public void setCeadService(CustomEntityAttributesDefinitionService ceadService) { | ||
| this.ceadService = ceadService; | ||
|
|
||
| } | ||
|
|
||
| public List<RelyingPartyOverrideProperty> getOverrides() { | ||
| return overrides; | ||
| /** | ||
| * This setter will get used by Spring's property system to create objects from a config file (should the properties exist) | ||
| */ | ||
| public void setOverrides(List<RelyingPartyOverrideProperty> overridesFromConfigFile) { | ||
| this.overridesFromConfigFile = overridesFromConfigFile; | ||
| } | ||
|
|
||
| @PostConstruct | ||
| public void postConstruct() { | ||
| // Register with service to get the updates when changes are made to the DB definitions | ||
| // ceadService.setCustomPropertiesConfiguration(this); | ||
| buildRelyingPartyOverrides(); | ||
| } | ||
|
|
||
| public void setOverrides(List<RelyingPartyOverrideProperty> overrides) { | ||
| this.overrides = overrides; | ||
| private void buildRelyingPartyOverrides() { | ||
| // We only want to add to an override if the incoming override (by name) isn't already in the list of overrides | ||
| for(RelyingPartyOverrideProperty rpop : this.overridesFromConfigFile) { | ||
| if (!this.overrides.containsKey(rpop.getName())) { | ||
| this.overrides.put(rpop.getName(), rpop); | ||
| } | ||
| } | ||
| } | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...ain/java/edu/internet2/tier/shibboleth/admin/ui/domain/IRelyingPartyOverrideProperty.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| package edu.internet2.tier.shibboleth.admin.ui.domain; | ||
|
|
||
| import java.util.Set; | ||
|
|
||
| enum CustomAttributeType { | ||
| BOOLEAN, DOUBLE, DURATION, INTEGER, LONG, SELECTION_LIST, SPRING_BEAN_ID, STRING | ||
| } | ||
|
|
||
| public interface IRelyingPartyOverrideProperty { | ||
| public String getAttributeFriendlyName(); | ||
|
|
||
| public String getAttributeName(); | ||
|
|
||
| public String getDefaultValue(); | ||
|
|
||
| public Set<String> getDefaultValues(); | ||
|
|
||
| public String getDisplayName(); | ||
|
|
||
| public String getDisplayType(); | ||
|
|
||
| public String getHelpText(); | ||
|
|
||
| public String getInvert(); | ||
|
|
||
| public String getName(); | ||
|
|
||
| public String getPersistType(); | ||
|
|
||
| public String getPersistValue(); | ||
|
|
||
| public void setAttributeFriendlyName(String attributeFriendlyName); | ||
|
|
||
| public void setAttributeName(String attributeName); | ||
|
|
||
| public void setDefaultValue(String defaultValue); | ||
|
|
||
| public void setDefaultValues(Set<String> defaultValues); | ||
|
|
||
| public void setDisplayName(String displayName); | ||
|
|
||
| public void setDisplayType(String displayType); | ||
|
|
||
| public void setHelpText(String helpText); | ||
|
|
||
| public void setInvert(String invert); | ||
|
|
||
| public void setName(String name); | ||
|
|
||
| public void setPersistType(String persistType); | ||
|
|
||
| public void setPersistValue(String persistValue); | ||
| } |
36 changes: 11 additions & 25 deletions
36
...main/java/edu/internet2/tier/shibboleth/admin/ui/domain/RelyingPartyOverrideProperty.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,41 +1,27 @@ | ||
| package edu.internet2.tier.shibboleth.admin.ui.domain; | ||
|
|
||
| import java.util.Set; | ||
|
|
||
| import lombok.Getter; | ||
| import lombok.Setter; | ||
|
|
||
| import java.util.List; | ||
| import lombok.ToString; | ||
|
|
||
| /** | ||
| * @author Bill Smith (wsmith@unicon.net) | ||
| */ | ||
| @Setter | ||
| @Getter | ||
| public class RelyingPartyOverrideProperty { | ||
| private String name; | ||
| @ToString | ||
| public class RelyingPartyOverrideProperty implements IRelyingPartyOverrideProperty { | ||
| private String attributeFriendlyName; | ||
| private String attributeName; | ||
| private String defaultValue; | ||
| private Set<String> defaultValues; | ||
| private String displayName; | ||
| private String displayType; | ||
| private String defaultValue; | ||
| private String helpText; | ||
| private List<String> defaultValues; | ||
| private String invert; | ||
| private String name; | ||
| private String persistType; | ||
| private String persistValue; | ||
| private String attributeName; | ||
| private String attributeFriendlyName; | ||
| private String invert; | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return "RelyingPartyOverrideProperty{" | ||
| + "\nname='" + name + '\'' | ||
| + ", \ndisplayName='" + displayName + '\'' | ||
| + ", \ndisplayType='" + displayType + '\'' | ||
| + ", \ndefaultValue='" + defaultValue + '\'' | ||
| + ", \nhelpText='" + helpText + '\'' | ||
| + ", \npersistType='" + persistType + '\'' | ||
| + ", \npersistValue='" + persistValue + '\'' | ||
| + ", \ndefaultValues=" + defaultValues | ||
| + ", \nattributeName='" + attributeName + '\'' | ||
| + ", \nattributeFriendlyName='" + attributeFriendlyName + '\'' | ||
| + "\n}"; | ||
| } | ||
| } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 7 additions & 13 deletions
20
...nd/src/main/java/edu/internet2/tier/shibboleth/admin/ui/service/JPAEntityServiceImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.