-
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.
Stub out service endpoint
- Loading branch information
Jj!
committed
Apr 27, 2018
1 parent
85e508b
commit 5765f49
Showing
6 changed files
with
109 additions
and
1 deletion.
There are no files selected for viewing
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
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
4 changes: 4 additions & 0 deletions
4
...src/main/java/edu/internet2/tier/shibboleth/admin/ui/service/MetadataResolverService.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,5 +1,9 @@ | ||
package edu.internet2.tier.shibboleth.admin.ui.service; | ||
|
||
import org.w3c.dom.Document; | ||
|
||
public interface MetadataResolverService { | ||
public void reloadFilters(String metadataResolverName); | ||
|
||
public Document generateConfiguration(); | ||
} |
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
72 changes: 72 additions & 0 deletions
72
...rnet2/tier/shibboleth/admin/ui/service/IncommonJPAMetadataResolverServiceImplTests.groovy
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,72 @@ | ||
package edu.internet2.tier.shibboleth.admin.ui.service | ||
|
||
import edu.internet2.tier.shibboleth.admin.ui.configuration.CoreShibUiConfiguration | ||
import edu.internet2.tier.shibboleth.admin.ui.configuration.SearchConfiguration | ||
import edu.internet2.tier.shibboleth.admin.ui.opensaml.OpenSamlObjects | ||
import edu.internet2.tier.shibboleth.admin.ui.repository.MetadataResolverRepository | ||
import org.apache.http.impl.client.HttpClients | ||
import org.opensaml.saml.metadata.resolver.ChainingMetadataResolver | ||
import org.opensaml.saml.metadata.resolver.MetadataResolver | ||
import org.opensaml.saml.metadata.resolver.impl.FileBackedHTTPMetadataResolver | ||
import org.springframework.beans.factory.annotation.Autowired | ||
import org.springframework.boot.autoconfigure.domain.EntityScan | ||
import org.springframework.boot.test.autoconfigure.orm.jpa.DataJpaTest | ||
import org.springframework.boot.test.context.SpringBootTest | ||
import org.springframework.boot.test.context.TestConfiguration | ||
import org.springframework.context.annotation.Bean | ||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories | ||
import org.springframework.test.context.ContextConfiguration | ||
import org.xmlunit.builder.DiffBuilder | ||
import org.xmlunit.builder.Input | ||
import spock.lang.Specification | ||
|
||
@SpringBootTest | ||
@DataJpaTest | ||
@ContextConfiguration(classes = [CoreShibUiConfiguration, SearchConfiguration]) | ||
@EnableJpaRepositories(basePackages = ["edu.internet2.tier.shibboleth.admin.ui"]) | ||
@EntityScan("edu.internet2.tier.shibboleth.admin.ui") | ||
class IncommonJPAMetadataResolverServiceImplTests extends Specification { | ||
@Autowired | ||
MetadataResolverService metadataResolverService | ||
|
||
def 'test generation of metadata-providers.xml'() { | ||
when: | ||
def output = metadataResolverService.generateConfiguration() | ||
|
||
then: | ||
assert !DiffBuilder.compare(Input.fromStream(this.class.getResourceAsStream('/conf/278.xml'))).withTest(Input.fromDocument(output)).ignoreComments().ignoreWhitespace().build().hasDifferences() | ||
} | ||
|
||
//TODO: check that this configuration is sufficient | ||
@TestConfiguration | ||
static class Config { | ||
@Autowired | ||
OpenSamlObjects openSamlObjects | ||
|
||
@Autowired | ||
MetadataResolverRepository metadataResolverRepository | ||
|
||
@Bean | ||
MetadataResolver metadataResolver() { | ||
def resolver = new ChainingMetadataResolver().with { | ||
it.id = 'chain' | ||
|
||
resolvers = [ | ||
[ | ||
'id': { 'incommonmd' } | ||
] as MetadataResolver | ||
] | ||
it.initialize() | ||
it | ||
} | ||
|
||
if (!metadataResolverRepository.findAll().iterator().hasNext()) { | ||
edu.internet2.tier.shibboleth.admin.ui.domain.MetadataResolver mr = new edu.internet2.tier.shibboleth.admin.ui.domain.MetadataResolver() | ||
mr.setName("incommonmd") | ||
metadataResolverRepository.save(mr) | ||
} | ||
|
||
return resolver | ||
} | ||
} | ||
} |
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,19 @@ | ||
<?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" | ||
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"> | ||
<MetadataProvider id="HTTPMetadata" | ||
xsi:type="FileBackedHTTPMetadataProvider" | ||
backingFile="%{idp.home}/metadata/incommonmd.xml" | ||
metadataURL="http://md.incommon.org/InCommon/InCommon-metadata.xml"> | ||
</MetadataProvider> | ||
|
||
</MetadataProvider> |