Skip to content

Commit

Permalink
SHIBUI-1992
Browse files Browse the repository at this point in the history
Removed defaults:
metadataresolver.enabled:true
  • Loading branch information
chasegawa committed Jul 27, 2021
1 parent fc8bba5 commit f121582
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public class MetadataResolver extends AbstractAuditable {
@Column(unique = true)
private String xmlId;

private Boolean enabled = true;
private Boolean enabled;

private Boolean requireValidMetadata = true;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,7 @@ class JPAMetadataResolverServiceImplTests extends Specification {
it.content = 'http://mdq-beta.incommon.org/global'
it
}
it.enabled = Boolean.TRUE
it
}
metadataResolverRepository.save(resolver)
Expand All @@ -411,20 +412,38 @@ class JPAMetadataResolverServiceImplTests extends Specification {
}

@DirtiesContext(methodMode = DirtiesContext.MethodMode.AFTER_METHOD)
def 'test namespace protection in nonURL resolver'() {
def 'test namespace protection in nonURL resolver with resolver setting enabled=true'() {
setup:
shibUIConfiguration.protectedAttributeNamespaces = ['http://shibboleth.net/ns/profiles']
def resolver = new LocalDynamicMetadataResolver().with {
it.xmlId = 'LocalDynamic'
it.sourceDirectory = '/tmp'
it.enabled = Boolean.TRUE
it
}

when:
metadataResolverRepository.save(resolver)

then:
generatedXmlIsTheSameAsExpectedXml('/conf/1059.xml', metadataResolverService.generateConfiguration())
generatedXmlIsTheSameAsExpectedXml('/conf/1059-enabled.xml', metadataResolverService.generateConfiguration())
}

@DirtiesContext(methodMode = DirtiesContext.MethodMode.AFTER_METHOD)
def 'test namespace protection in nonURL resolver with resolver setting enabled not set'() {
setup:
shibUIConfiguration.protectedAttributeNamespaces = ['http://shibboleth.net/ns/profiles']
def resolver = new LocalDynamicMetadataResolver().with {
it.xmlId = 'LocalDynamic'
it.sourceDirectory = '/tmp'
it
}

when:
metadataResolverRepository.save(resolver)

then:
generatedXmlIsTheSameAsExpectedXml('/conf/1059-disabled.xml', metadataResolverService.generateConfiguration())
}

@Ignore('there is a bug in org.opensaml.saml.metadata.resolver.filter.impl.EntityAttributesFilter.applyFilter')
Expand Down
11 changes: 11 additions & 0 deletions backend/src/test/resources/conf/1059-disabled.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- This file is an EXAMPLE metadata configuration file. -->
<MetadataProvider id="ShibbolethMetadata" xsi:type="ChainingMetadataProvider"
xmlns="urn:mace:shibboleth:2.0:metadata"
xmlns:resource="urn:mace:shibboleth:2.0:resource"
xmlns:security="urn:mace:shibboleth:2.0:security"
xmlns:md="urn:oasis:names:tc:SAML:2.0:metadata"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:saml="urn:oasis:names:tc:SAML:2.0:assertion"
xsi:schemaLocation="urn:mace:shibboleth:2.0:metadata http://shibboleth.net/schema/idp/shibboleth-metadata.xsd urn:mace:shibboleth:2.0:resource http://shibboleth.net/schema/idp/shibboleth-resource.xsd urn:mace:shibboleth:2.0:security http://shibboleth.net/schema/idp/shibboleth-security.xsd urn:oasis:names:tc:SAML:2.0:metadata http://docs.oasis-open.org/security/saml/v2.0/saml-schema-metadata-2.0.xsd urn:oasis:names:tc:SAML:2.0:assertion http://docs.oasis-open.org/security/saml/v2.0/saml-schema-assertion-2.0.xsd">
</MetadataProvider>
File renamed without changes.

0 comments on commit f121582

Please sign in to comment.