MetadataGenerator { public ExtendedMetadata generateExtendedMetadata() { ExtendedMetadata metadata; if (extendedMetadata != null) { metadata = extendedMetadata.clone(); } else { metadata = new ExtendedMetadata(); } String entityBaseURL = getEntityBaseURL(); String entityAlias = getEntityAlias(); if (isIncludeDiscovery()) { metadata.setIdpDiscoveryURL(getDiscoveryURL(entityBaseURL, entityAlias)); metadata.setIdpDiscoveryResponseURL(getDiscoveryResponseURL(entityBaseURL, entityAlias)); } else { metadata.setIdpDiscoveryURL(null); metadata.setIdpDiscoveryResponseURL(null); } metadata.setLocal(true); return metadata; } MetadataGenerator(); EntityDescriptor generateMetadata(); ExtendedMetadata generateExtendedMetadata(); @Autowired(required = false) @Qualifier("samlWebSSOProcessingFilter") void setSamlWebSSOFilter(SAMLProcessingFilter samlWebSSOFilter); @Autowired(required = false) @Qualifier("samlWebSSOHoKProcessingFilter") void setSamlWebSSOHoKFilter(SAMLWebSSOHoKProcessingFilter samlWebSSOHoKFilter); @Autowired(required = false) void setSamlLogoutProcessingFilter(SAMLLogoutProcessingFilter samlLogoutProcessingFilter); @Autowired(required = false) void setSamlEntryPoint(SAMLEntryPoint samlEntryPoint); boolean isRequestSigned(); void setRequestSigned(boolean requestSigned); boolean isWantAssertionSigned(); void setWantAssertionSigned(boolean wantAssertionSigned); Collection<String> getNameID(); void setNameID(Collection<String> nameID); String getEntityBaseURL(); void setEntityBaseURL(String entityBaseURL); @Autowired void setKeyManager(KeyManager keyManager); void setId(String id); String getId(); void setEntityId(String entityId); String getEntityId(); Collection<String> getBindingsSSO(); void setBindingsSSO(Collection<String> bindingsSSO); Collection<String> getBindingsSLO(); void setBindingsSLO(Collection<String> bindingsSLO); Collection<String> getBindingsHoKSSO(); void setBindingsHoKSSO(Collection<String> bindingsHoKSSO); boolean isIncludeDiscoveryExtension(); void setIncludeDiscoveryExtension(boolean includeDiscoveryExtension); int getAssertionConsumerIndex(); void setAssertionConsumerIndex(int assertionConsumerIndex); ExtendedMetadata getExtendedMetadata(); void setExtendedMetadata(ExtendedMetadata extendedMetadata); static final Collection<String> defaultNameID; }
@Test public void testGenerateExtendedMetadata() { ExtendedMetadata extendedMetadata; generator.setExtendedMetadata(new ExtendedMetadata()); generator.setEntityBaseURL("http: generator.getExtendedMetadata().setAlias("testAlias"); generator.getExtendedMetadata().setIdpDiscoveryEnabled(true); extendedMetadata = generator.generateExtendedMetadata(); assertEquals("testAlias", extendedMetadata.getAlias()); assertTrue(extendedMetadata.isLocal()); assertTrue(extendedMetadata.isIdpDiscoveryEnabled()); assertEquals("http: assertEquals("http: generator.getExtendedMetadata().setIdpDiscoveryEnabled(false); generator.setIncludeDiscoveryExtension(false); extendedMetadata = generator.generateExtendedMetadata(); assertFalse(extendedMetadata.isIdpDiscoveryEnabled()); assertNull(extendedMetadata.getIdpDiscoveryURL()); assertNull(extendedMetadata.getIdpDiscoveryResponseURL()); generator.setExtendedMetadata(new ExtendedMetadata()); generator.getExtendedMetadata().setRequireLogoutResponseSigned(true); generator.getExtendedMetadata().setIdpDiscoveryEnabled(true); generator.getExtendedMetadata().setIdpDiscoveryResponseURL("http: generator.setIncludeDiscoveryExtension(true); extendedMetadata = generator.generateExtendedMetadata(); assertTrue(extendedMetadata.isIdpDiscoveryEnabled()); assertEquals("http: assertEquals("http: assertTrue(extendedMetadata.isRequireLogoutResponseSigned()); }