Skip to content

Commit

Permalink
Merged in SHIBUI-670 (pull request #123)
Browse files Browse the repository at this point in the history
SHIBUI-670

Approved-by: Shibui Jenkins <shibui.jenkins@gmail.com>
Approved-by: Bill Smith <wsmith@unicon.net>
Approved-by: Ryan Mathis <rmathis@unicon.net>
  • Loading branch information
dima767 authored and rmathis committed Jul 24, 2018
2 parents 00d7968 + cb54cb6 commit fd41d03
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class JPAMetadataResolverServiceImpl implements MetadataResolverService {
) {
metadataResolverRepository.findAll().each { edu.internet2.tier.shibboleth.admin.ui.domain.resolvers.MetadataResolver mr ->
//TODO: We cannot/do not currently have the code to marshall the internal incommon chaining resolver
if (mr.type != 'BaseMetadataResolver') {
if ((mr.type != 'BaseMetadataResolver') && (mr.enabled)) {
constructXmlNodeForResolver(mr, delegate) {
MetadataFilter(
'xsi:type': 'SignatureValidation',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public class MetadataResolver extends AbstractAuditable {
@Column(unique = true)
private String xmlId;

private Boolean enabled = true;

private Boolean requireValidMetadata = true;

private Boolean failFastInitialization = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -229,6 +229,19 @@ class JPAMetadataResolverServiceImplTests extends Specification {
generatedXmlIsTheSameAsExpectedXml('/conf/520.xml', domBuilder.parseText(writer.toString()))
}

def 'test generating disabled MetadataResolver xml snippet'() {
given: 'disabled metadata resolver'
def resolver = testObjectGenerator.filesystemMetadataResolver()
resolver.enabled = false
metadataResolverRepository.save(resolver)

when:
def generatedXmlDocument = this.metadataResolverService.generateConfiguration()

then:
generatedXmlIsTheSameAsExpectedXml('/conf/670.xml', generatedXmlDocument)
}

static genXmlSnippet(MarkupBuilder xml, Closure xmlNodeGenerator) {
xml.MetadataProvider('id': 'ShibbolethMetadata',
'xmlns': 'urn:mace:shibboleth:2.0:metadata',
Expand Down
11 changes: 11 additions & 0 deletions backend/src/test/resources/conf/670.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>

0 comments on commit fd41d03

Please sign in to comment.