Skip to content

Commit

Permalink
SHIBUI-900 Fixed merge conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
rmathis committed Sep 25, 2018
2 parents b92ce9c + 9444d86 commit c281051
Show file tree
Hide file tree
Showing 32 changed files with 304 additions and 70 deletions.
5 changes: 4 additions & 1 deletion backend/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,9 @@ dependencies {
// TODO: figure out what this should really be
runtimeOnly 'org.springframework.boot:spring-boot-starter-tomcat'

//Spring Configuration Annotation Processor - makes IntelliJ happy about @ConfigurationProperties
compileOnly "org.springframework.boot:spring-boot-configuration-processor"

// lucene deps
['core', 'analyzers-common', 'queryparser'].each {
compile "org.apache.lucene:lucene-${it}:${project.'lucene.version'}"
Expand Down Expand Up @@ -218,4 +221,4 @@ docker {
noCache true
files tasks.bootWar.outputs
buildArgs(['JAR_FILE': 'shibui.war'])
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ResourceBundleMessageSource;
Expand All @@ -42,6 +43,7 @@
import javax.servlet.http.HttpServletRequest;

@Configuration
@EnableConfigurationProperties(CustomAttributesConfiguration.class)
public class CoreShibUiConfiguration {
private static final Logger logger = LoggerFactory.getLogger(CoreShibUiConfiguration.class);

Expand Down Expand Up @@ -170,6 +172,11 @@ public LuceneUtility luceneUtility(DirectoryService directoryService) {
return new LuceneUtility(directoryService);
}

@Bean
public CustomAttributesConfiguration customAttributesConfiguration() {
return new CustomAttributesConfiguration();
}

@Bean
public Module stringTrimModule() {
return new StringTrimModule();
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package edu.internet2.tier.shibboleth.admin.ui.configuration;

import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Configuration;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
* @author Bill Smith (wsmith@unicon.net)
*/
@Configuration
@ConfigurationProperties(prefix="custom")
public class CustomAttributesConfiguration {

private List<? extends Map<String, String>> attributes = new ArrayList<>();

public List<? extends Map<String, String>> getAttributes() {
return attributes;
}

public void setAttributes(List<? extends Map<String, String>> attributes) {
this.attributes = attributes;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package edu.internet2.tier.shibboleth.admin.ui.controller;

import edu.internet2.tier.shibboleth.admin.ui.configuration.CustomAttributesConfiguration;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

/**
* @author Bill Smith (wsmith@unicon.net)
*/
@Controller
@RequestMapping(value = "/api")
public class ConfigurationController {

@Autowired
CustomAttributesConfiguration customAttributesConfiguration;

@GetMapping(value = "/customAttributes")
public ResponseEntity<?> getCustomAttributes() {
return ResponseEntity.ok(customAttributesConfiguration.getAttributes());
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,11 @@ public static List<String> getAttributeReleaseListFromAttributeList(List<Attribu
.filter(attribute -> attribute.getName().equals(MDDCConstants.RELEASE_ATTRIBUTES))
.collect(Collectors.toList());

if (releaseAttributes.size() != 1) {
// TODO: What do we do if there is more than one?
}
if (releaseAttributes.size() == 0) {
return new ArrayList<>();
} else {
return getStringListOfAttributeValues(releaseAttributes.get(0).getAttributeValues());
List<String> attributeValues = new ArrayList<>();
for (Attribute attribute : releaseAttributes) {
attributeValues.addAll(getStringListOfAttributeValues(attribute.getAttributeValues()));
}
return attributeValues;
}

public static boolean getBooleanValueOfAttribute(Attribute attribute) {
Expand Down
28 changes: 28 additions & 0 deletions backend/src/main/resources/application.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
custom:
attributes:
# Default attributes
- name: eduPersonPrincipalName
displayName: label.attribute-eduPersonPrincipalName
- name: uid
displayName: label.attribute-uid
- name: mail
displayName: label.attribute-mail
- name: surname
displayName: label.attribute-surname
- name: givenName
displayName: label.attribute-givenName
- name: eduPersonAffiliation
displayName: label.attribute-eduPersonAffiliation
- name: eduPersonScopedAffiliation
displayName: label.attribute-eduPersonScopedAffiliation
- name: eduPersonPrimaryAffiliation
displayName: label.attribute-eduPersonPrimaryAffiliation
- name: eduPersonEntitlement
displayName: label.attribute-eduPersonEntitlement
- name: eduPersonAssurance
displayName: label.attribute-eduPersonAssurance
- name: eduPersonUniqueId
displayName: label.attribute-eduPersonUniqueId
- name: employeeNumber
displayName: label.attribute-employeeNumber
# Custom attributes
15 changes: 14 additions & 1 deletion backend/src/main/resources/i18n/messages_en.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ action.clear=Clear
action.delete=Delete
action.remove=Remove
action.save=Save
action.toggle=Toggle { label }
action.toggle=Toggle
action.add-contact=Add Contact
action.add-contacts=Add Contacts
action.use-mine=Use My Changes
Expand Down Expand Up @@ -310,6 +310,19 @@ label.assertion=Assertion Consumer Service
label.relying-party=Relying Party Overrides
label.org-info=Organization Information

label.attribute-eduPersonPrincipalName=eduPersonPrincipalName (EPPN)
label.attribute-uid=uid
label.attribute-mail=mail
label.attribute-surname=surname
label.attribute-givenName=givenName
label.attribute-eduPersonAffiliation=eduPersonAffiliation
label.attribute-eduPersonScopedAffiliation=eduPersonScopedAffiliation
label.attribute-eduPersonPrimaryAffiliation=eduPersonPrimaryAffiliation
label.attribute-eduPersonEntitlement=eduPersonEntitlement
label.attribute-eduPersonAssurance=eduPersonAssurance
label.attribute-eduPersonUniqueId=eduPersonUniqueId
label.attribute-employeeNumber=employeeNumber

message.must-be-unique=Must be unique.
message.name-must-be-unique=Name must be unique.
message.uri-valid-format=URI must be valid format.
Expand Down
36 changes: 29 additions & 7 deletions backend/src/main/resources/i18n/messages_es.properties
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ action.clear=(es) Clear
action.delete=(es) Delete
action.remove=(es) Remove
action.save=(es) Save
action.toggle=(es) Toggle { label }
action.toggle=(es) Toggle
action.add-contact=(es) Add Contact
action.add-contacts=(es) Add Contacts
action.use-mine=(es) Use My Changes
Expand All @@ -32,6 +32,11 @@ action.search-by=(es) Search By
action.preview=(es) Preview
action.select-metadata-filter-type=(es) Select a metadata filter type
action.add-authentication-method=(es) Add Authentication Method
action.move-up=(es) Move Up
action.move-down=(es) Move Down
action.edit=(es) Edit
action.add-filter=(es) Add Filter
action.manage-filters=(es) Manage Filters

value.enabled=(es) Enabled
value.disabled=(es) Disabled
Expand All @@ -40,9 +45,9 @@ value.file=(es) File
value.memory=(es) Memory
value.true=(es) True
value.false=(es) False
label.regex=(es) Regex
label.script=(es) Script
label.entity-id=(es) Entity ID
value.regex=(es) Regex
value.script=(es) Script
value.entity-id=(es) Entity ID

value.file-backed-http-metadata-provider=(es) FileBackedHttpMetadataProvider
value.entity-attributes-filter=(es) EntityAttributes Filter
Expand Down Expand Up @@ -205,6 +210,7 @@ label.service-enabled=(es) Service Enabled
label.filter-name=(es) Filter Name
label.filter-enabled=(es) Filter Enabled
label.filter-target=(es) FilterTarget
label.filter-type=(es) Filter Type
label.value=(es) Value
label.binding-type=(es) Binding Type
label.sign-assertion=(es) Sign Assertions
Expand Down Expand Up @@ -273,10 +279,12 @@ label.metadata-url=(es) Metadata URL
label.xml-id=(es) ID
label.enable-service=(es) Enable this service?
label.metadata-provider-type=(es) Metadata Provider Type
label.metadata-provider-name=(es) Metadata Provider Name (Dashboard Display Only)
label.metadata-provider-name=(es) Metadata Provider Name
label.select-metadata-type=(es) Select a metadata provider type
label.metadata-provider-status=(es) Metadata Provider Status
label.enable-provider-upon-saving=(es) Enable Metadata Provider upon saving?

label.enable-filter=(es) Enable Filter?
label.required-valid-until=(es) Required Valid Until Filter
label.max-validity-interval=(es) Max Validity Interval
label.signature-validation-filter=(es) Signature Validation Filter
Expand All @@ -293,6 +301,7 @@ label.common-attributes=(es) Common Attributes
label.reloading-attributes=(es) Reloading Attributes
label.metadata-filter-plugins=(es) Metadata Filter Plugins
label.advanced-settings=(es) Advanced Settings
label.edit-metadata-provider=(es) Edit Metadata Provider

label.metadata-ui=(es) User Interface / MDUI Information
label.descriptor-info=(es) SP SSO Descriptor Information
Expand All @@ -301,6 +310,19 @@ label.assertion=(es) Assertion Consumer Service
label.relying-party=(es) Relying Party Overrides
label.org-info=(es) Organization Information

label.attribute-eduPersonPrincipalName=(es) eduPersonPrincipalName (EPPN)
label.attribute-uid=(es) uid
label.attribute-mail=(es) mail
label.attribute-surname=(es) surname
label.attribute-givenName=(es) givenName
label.attribute-eduPersonAffiliation=(es) eduPersonAffiliation
label.attribute-eduPersonScopedAffiliation=(es) eduPersonScopedAffiliation
label.attribute-eduPersonPrimaryAffiliation=(es) eduPersonPrimaryAffiliation
label.attribute-eduPersonEntitlement=(es) eduPersonEntitlement
label.attribute-eduPersonAssurance=(es) eduPersonAssurance
label.attribute-eduPersonUniqueId=(es) eduPersonUniqueId
label.attribute-employeeNumber=(es) employeeNumber

message.must-be-unique=(es) Must be unique.
message.name-must-be-unique=(es) Name must be unique.
message.uri-valid-format=(es) URI must be valid format.
Expand Down Expand Up @@ -420,5 +442,5 @@ tooltip.resolve-via-predicates-only=(es) Flag indicating whether resolution may
tooltip.expiration-warning-threshold=(es) For each attempted metadata refresh (whether or not fresh metadata is obtained), if requireValidMetadata is true, and there is a validUntil XML attribute on the document root element, and the difference between validUntil and the current time is less than expirationWarningThreshold, the system logs a warning about the impending expiration.

tooltip.filter-name=(es) Filter Name
tooltip.enable-filter=(es) Enable Filter ?
tooltip.enable-service=(es) Enable Service ?
tooltip.enable-filter=(es) Enable Filter?
tooltip.enable-service=(es) Enable Service?
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,8 @@ class TestObjectGenerator {
it.metadataURL = 'https://idp.unicon.net/idp/shibboleth'

it.reloadableMetadataResolverAttributes = new ReloadableMetadataResolverAttributes().with {
it.minRefreshDelay = 'PT0M'
it.maxRefreshDelay = 'P1D'
it
}
it
Expand Down
5 changes: 3 additions & 2 deletions backend/src/test/resources/conf/278.2.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,9 @@
<MetadataProvider id="HTTPMetadata"
xsi:type="FileBackedHTTPMetadataProvider"
backingFile="%{idp.home}/metadata/metadata.xml"
metadataURL="https://idp.unicon.net/idp/shibboleth">

metadataURL="https://idp.unicon.net/idp/shibboleth"
minRefreshDelay='PT0M'
maxRefreshDelay='P1D'>
<MetadataFilter xsi:type="SignatureValidation" requireSignedRoot="true"
certificateFile="%{idp.home}/credentials/inc-md-cert.pem" />
</MetadataProvider>
Expand Down
4 changes: 3 additions & 1 deletion backend/src/test/resources/conf/278.xml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
<MetadataProvider id="HTTPMetadata"
xsi:type="FileBackedHTTPMetadataProvider"
backingFile="%{idp.home}/metadata/metadata.xml"
metadataURL="https://idp.unicon.net/idp/shibboleth">
metadataURL="https://idp.unicon.net/idp/shibboleth"
minRefreshDelay='PT0M'
maxRefreshDelay='P1D'>
<MetadataFilter xsi:type="SignatureValidation" requireSignedRoot="true"
certificateFile="%{idp.home}/credentials/inc-md-cert.pem" />
</MetadataProvider>
Expand Down
5 changes: 3 additions & 2 deletions backend/src/test/resources/conf/532.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<MetadataProvider id="HTTPMetadata"
xsi:type="FileBackedHTTPMetadataProvider"
backingFile="%{idp.home}/metadata/metadata.xml"
metadataURL="https://idp.unicon.net/idp/shibboleth" />

metadataURL="https://idp.unicon.net/idp/shibboleth"
minRefreshDelay='PT0M'
maxRefreshDelay='P1D' />
</MetadataProvider>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</thead>
<tbody>
<tr *ngFor="let attr of listOfAttributes$ | async; let i=index;">
<td scope="col">{{ attr.label }}</td>
<td scope="col" [translate]="attr.label">{{ attr.label }}</td>
<td scope="col">
<fieldset>
<div class="custom-control custom-checkbox">
Expand All @@ -19,8 +19,8 @@
(change)="onCheck($event, attr.key)"
[checked]="isChecked(attr.key)"
id="input-{{ i }}"
[attr.name]="attr.label"
[attr.aria-label]="attr.label"
[attr.name]="attr.label | translate"
[attr.aria-label]="attr.label | translate"
role="checkbox"
aria-checked="false"/>
<label class="custom-control-label" for="input-{{ i }}"></label>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { AttributeReleaseFormComponent } from './attribute-release-form.componen
import { ListValuesService } from '../../../domain/service/list-values.service';
import * as stubs from '../../../../../testing/resolver.stub';
import { MockI18nModule } from '../../../../../testing/i18n.stub';
import { MockListValueService } from '../../../../../testing/list-values.stub';

describe('Attribute Release Form Component', () => {
let fixture: ComponentFixture<AttributeReleaseFormComponent>;
Expand All @@ -19,7 +20,7 @@ describe('Attribute Release Form Component', () => {
ProviderValueEmitter,
ProviderStatusEmitter,
NgbPopoverConfig,
ListValuesService
{ provide: ListValuesService, useClass: MockListValueService }
],
imports: [
NoopAnimationsModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import { DescriptorInfoFormComponent } from './descriptor-info-form.component';
import * as stubs from '../../../../../testing/resolver.stub';
import { SharedModule } from '../../../../shared/shared.module';
import { MockI18nModule } from '../../../../../testing/i18n.stub';
import { MockListValueService } from '../../../../../testing/list-values.stub';

@Component({
template: `<descriptor-info-form [resolver]="resolver"></descriptor-info-form>`
Expand Down Expand Up @@ -48,7 +49,7 @@ describe('Descriptor Info Form Component', () => {
ProviderValueEmitter,
ProviderStatusEmitter,
NgbPopoverConfig,
ListValuesService
{ provide: ListValuesService, useClass: MockListValueService }
],
imports: [
NoopAnimationsModule,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import * as stubs from '../../../../../testing/resolver.stub';
import { FileBackedHttpMetadataResolver } from '../../entity';
import { InputDefaultsDirective } from '../../../../shared/directive/input-defaults.directive';
import { MockI18nModule } from '../../../../../testing/i18n.stub';
import { MockListValueService } from '../../../../../testing/list-values.stub';

@Component({
template: `<finish-form [resolver]="resolver"></finish-form>`
Expand Down Expand Up @@ -42,7 +43,7 @@ describe('Finished Form Component', () => {
ProviderValueEmitter,
ProviderStatusEmitter,
NgbPopoverConfig,
ListValuesService,
{ provide: ListValuesService, useClass: MockListValueService },
{ provide: Router, useClass: RouterStub },
{ provide: ActivatedRoute, useClass: ActivatedRouteStub }
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import * as stubs from '../../../../../testing/resolver.stub';
import { FileBackedHttpMetadataResolver } from '../../entity';
import { InputDefaultsDirective } from '../../../../shared/directive/input-defaults.directive';
import { MockI18nModule } from '../../../../../testing/i18n.stub';
import { MockListValueService } from '../../../../../testing/list-values.stub';

@Component({
template: `<key-info-form [resolver]="resolver"></key-info-form>`
Expand Down Expand Up @@ -43,7 +44,7 @@ describe('Security (Key) Info Form Component', () => {
ProviderValueEmitter,
ProviderStatusEmitter,
NgbPopoverConfig,
ListValuesService
{ provide: ListValuesService, useClass: MockListValueService }
],
imports: [
NoopAnimationsModule,
Expand Down
Loading

0 comments on commit c281051

Please sign in to comment.