本文整理汇总了Java中org.springframework.security.saml.metadata.MetadataManager类的典型用法代码示例。如果您正苦于以下问题:Java MetadataManager类的具体用法?Java MetadataManager怎么用?Java MetadataManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MetadataManager类属于org.springframework.security.saml.metadata包,在下文中一共展示了MetadataManager类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: SAMLContext
import org.springframework.security.saml.metadata.MetadataManager; //导入依赖的package包/类
public SAMLContext(final HttpServletRequest request, final SAMLConfig configuration) throws ConfigurationException, CertificateException, UnsupportedEncodingException, MetadataProviderException, ServletException, ResourceException {
configuration.setDefaultBaseUrl(getDefaultBaseURL(request));
idpKeyManager = new IdpKeyManager(configuration.getIdpEntityId(), configuration.getX509Certificate());
SpMetadataGenerator spMetadataGenerator = new SpMetadataGenerator();
MetadataProvider spMetadataProvider = spMetadataGenerator.generate(configuration);
IdpMetadataGenerator idpMetadataGenerator = new IdpMetadataGenerator();
MetadataProvider idpMetadataProvider = idpMetadataGenerator.generate(configuration);
metadataManager = new MetadataManager(Arrays.asList(spMetadataProvider, idpMetadataProvider));
metadataManager.setKeyManager(idpKeyManager);
metadataManager.setHostedSPName(configuration.getSpEntityId());
metadataManager.refreshMetadata();
messageContextProvider = new SAMLContextProviderImpl();
messageContextProvider.setMetadata(metadataManager);
messageContextProvider.setKeyManager(idpKeyManager);
messageContextProvider.afterPropertiesSet();
}
示例2: configure_constructor
import org.springframework.security.saml.metadata.MetadataManager; //导入依赖的package包/类
@Test
public void configure_constructor() throws Exception {
MetadataManager metadataManager = mock(MetadataManager.class);
MetadataManagerConfigurer configurer = spy(new MetadataManagerConfigurer(metadataManager));
configurer.setBuilder(builder);
configurer.init(builder);
configurer.configure(builder);
verify(builder).setSharedObject(eq(MetadataManager.class), eq(metadataManager));
ArgumentCaptor<List> providersCaptor = ArgumentCaptor.forClass(List.class);
verify(metadataManager).setProviders((List<MetadataProvider>) providersCaptor.capture());
verify(configurer).createDefaultMetadataProvider(eq(idpConfiguration.getMetadataLocation()));
verify(configurer).createDefaultExtendedMetadataDelegate(any(ResourceBackedMetadataProvider.class), any());
verify(metadataManagerProperties, never()).getDefaultIdp();
verify(metadataManagerProperties, never()).getHostedSpName();
verify(metadataManagerProperties, never()).getRefreshCheckInterval();
verify(extendedMetadataDelegateProperties).isForceMetadataRevocationCheck();
verify(extendedMetadataDelegateProperties).isMetadataRequireSignature();
verify(extendedMetadataDelegateProperties).isMetadataTrustCheck();
verify(extendedMetadataDelegateProperties).isRequireValidMetadata();
verify(extendedMetadataDelegateProperties).getMetadataTrustedKeys();
List<MetadataProvider> providers = providersCaptor.getValue();
assertThat(providers).hasSize(1);
assertThat(providers.get(0)).isExactlyInstanceOf(ExtendedMetadataDelegate.class);
assertThat(((ExtendedMetadataDelegate) providers.get(0)).getDelegate()).isExactlyInstanceOf(ResourceBackedMetadataProvider.class);
}
示例3: init
import org.springframework.security.saml.metadata.MetadataManager; //导入依赖的package包/类
@Override
public void init(ServiceProviderBuilder builder) throws Exception {
resourceLoader = builder.getSharedObject(ResourceLoader.class);
metadataManagerBean = builder.getSharedObject(MetadataManager.class);
extendedDelegateConfig = builder.getSharedObject(SAMLSSOProperties.class).getExtendedDelegate();
localExtendedDelegateConfig = builder.getSharedObject(SAMLSSOProperties.class).getLocalExtendedDelegate();
managerConfig = builder.getSharedObject(SAMLSSOProperties.class).getMetadataManager();
idpConfig = builder.getSharedObject(SAMLSSOProperties.class).getIdp();
}
示例4: afterPropertiesSet
import org.springframework.security.saml.metadata.MetadataManager; //导入依赖的package包/类
@Override
public void afterPropertiesSet() {
//All existing beans are thrown as shared objects to the ServiceProviderSecurityBuilder, which will wire all
//beans/objects related to spring security SAML.
serviceProviderBuilder.setSharedObject(ParserPool.class, ParserPoolHolder.getPool());
serviceProviderBuilder.setSharedObject(WebSSOProfileConsumerImpl.class, (WebSSOProfileConsumerImpl) webSSOProfileConsumer);
serviceProviderBuilder.setSharedObject(WebSSOProfileConsumerHoKImpl.class, hokWebSSOProfileConsumer);
serviceProviderBuilder.setSharedObject(ServiceProviderEndpoints.class, new ServiceProviderEndpoints());
serviceProviderBuilder.setSharedObject(ResourceLoader.class, resourceLoader);
serviceProviderBuilder.setSharedObject(SAMLSSOProperties.class, sAMLSsoProperties);
serviceProviderBuilder.setSharedObject(ExtendedMetadata.class, extendedMetadata);
serviceProviderBuilder.setSharedObject(LocalExtendedMetadata.class, localExtendedMetadata);
serviceProviderBuilder.setSharedObject(SAMLAuthenticationProvider.class, samlAuthenticationProvider);
serviceProviderBuilder.setSharedObject(SAMLContextProvider.class, samlContextProvider);
serviceProviderBuilder.setSharedObject(KeyManager.class, keyManager);
serviceProviderBuilder.setSharedObject(MetadataManager.class, metadataManager);
serviceProviderBuilder.setSharedObject(MetadataGenerator.class, metadataGenerator);
serviceProviderBuilder.setSharedObject(SAMLProcessor.class, samlProcessor);
serviceProviderBuilder.setSharedObject(WebSSOProfile.class, webSSOProfile);
serviceProviderBuilder.setSharedObject(WebSSOProfileECPImpl.class, ecpProfile);
serviceProviderBuilder.setSharedObject(WebSSOProfileHoKImpl.class, hokWebSSOProfile);
serviceProviderBuilder.setSharedObject(SingleLogoutProfile.class, sloProfile);
serviceProviderBuilder.setSharedObject(WebSSOProfileConsumer.class, webSSOProfileConsumer);
serviceProviderBuilder.setSharedObject(WebSSOProfileConsumerHoKImpl.class, hokWebSSOProfileConsumer);
serviceProviderBuilder.setSharedObject(SAMLLogger.class, samlLogger);
}
开发者ID:ulisesbocchio,项目名称:spring-boot-security-saml,代码行数:27,代码来源:SAMLServiceProviderSecurityConfiguration.java
示例5: init
import org.springframework.security.saml.metadata.MetadataManager; //导入依赖的package包/类
@Test
public void init() throws Exception {
MetadataManagerConfigurer configurer = new MetadataManagerConfigurer();
configurer.init(builder);
verify(builder).getSharedObject(eq(MetadataManager.class));
verify(builder, atLeastOnce()).getSharedObject(eq(SAMLSSOProperties.class));
verify(builder).getSharedObject(eq(ResourceLoader.class));
verify(properties).getMetadataManager();
verify(properties).getExtendedDelegate();
}
示例6: configure_bean
import org.springframework.security.saml.metadata.MetadataManager; //导入依赖的package包/类
@Test
public void configure_bean() throws Exception {
MetadataManager metadataManager = mock(MetadataManager.class);
when(builder.getSharedObject(MetadataManager.class)).thenReturn(metadataManager);
MetadataManagerConfigurer configurer = new MetadataManagerConfigurer();
configurer.init(builder);
configurer.configure(builder);
verifyZeroInteractions(metadataManagerProperties, extendedMetadata);
verify(builder, never()).setSharedObject(eq(MetadataManager.class), any());
}
示例7: configure_defaults
import org.springframework.security.saml.metadata.MetadataManager; //导入依赖的package包/类
@Test
public void configure_defaults() throws Exception {
MetadataManagerConfigurer configurer = spy(new MetadataManagerConfigurer());
CachingMetadataManager metadataManager = mock(CachingMetadataManager.class);
when(configurer.createDefaultMetadataManager()).thenReturn(metadataManager);
ExtendedMetadataDelegate delegate = mock(ExtendedMetadataDelegate.class);
doReturn(delegate).when(configurer).createDefaultExtendedMetadataDelegate(any(), any());
configurer.setBuilder(builder);
configurer.init(builder);
configurer.configure(builder);
verify(builder).setSharedObject(eq(MetadataManager.class), eq(metadataManager));
ArgumentCaptor<List> providersCaptor = ArgumentCaptor.forClass(List.class);
verify(metadataManager).setProviders((List<MetadataProvider>) providersCaptor.capture());
verify(configurer).createDefaultMetadataProvider(eq(idpConfiguration.getMetadataLocation()));
verify(configurer).createDefaultExtendedMetadataDelegate(any(ResourceBackedMetadataProvider.class), any());
verify(metadataManagerProperties).getDefaultIdp();
verify(metadataManagerProperties).getHostedSpName();
verify(metadataManagerProperties).getRefreshCheckInterval();
verify(extendedMetadataDelegateProperties).isForceMetadataRevocationCheck();
verify(extendedMetadataDelegateProperties).isMetadataRequireSignature();
verify(extendedMetadataDelegateProperties).isMetadataTrustCheck();
verify(extendedMetadataDelegateProperties).isRequireValidMetadata();
verify(extendedMetadataDelegateProperties).getMetadataTrustedKeys();
List<MetadataProvider> providers = providersCaptor.getValue();
assertThat(providers).hasSize(1);
assertThat(providers.get(0)).isEqualTo(delegate);
verify(metadataManager).setDefaultIDP(eq(metadataManagerProperties.getDefaultIdp()));
verify(metadataManager).setHostedSPName(eq(metadataManagerProperties.getHostedSpName()));
verify(metadataManager).setRefreshCheckInterval(eq(metadataManagerProperties.getRefreshCheckInterval()));
verify(delegate).setForceMetadataRevocationCheck(eq(extendedMetadataDelegateProperties.isForceMetadataRevocationCheck()));
verify(delegate).setMetadataRequireSignature(eq(extendedMetadataDelegateProperties.isMetadataRequireSignature()));
verify(delegate).setMetadataTrustCheck(eq(extendedMetadataDelegateProperties.isMetadataTrustCheck()));
verify(delegate).setMetadataTrustedKeys(eq(extendedMetadataDelegateProperties.getMetadataTrustedKeys()));
verify(delegate).setRequireValidMetadata(eq(extendedMetadataDelegateProperties.isRequireValidMetadata()));
verify(delegate).setMetadataFilter((MetadataFilter) isNull());
}
示例8: configure_defaults_withProvider
import org.springframework.security.saml.metadata.MetadataManager; //导入依赖的package包/类
@Test
public void configure_defaults_withProvider() throws Exception {
MetadataManagerConfigurer configurer = spy(new MetadataManagerConfigurer());
CachingMetadataManager metadataManager = mock(CachingMetadataManager.class);
when(configurer.createDefaultMetadataManager()).thenReturn(metadataManager);
configurer.setBuilder(builder);
AbstractMetadataProvider provider = mock(AbstractMetadataProvider.class);
configurer.metadataProvider(provider);
configurer.init(builder);
configurer.configure(builder);
verify(builder).setSharedObject(eq(MetadataManager.class), eq(metadataManager));
ArgumentCaptor<List> providersCaptor = ArgumentCaptor.forClass(List.class);
verify(provider).setParserPool(eq(parserPool));
verify(metadataManager).setProviders((List<MetadataProvider>) providersCaptor.capture());
verify(configurer, never()).createDefaultMetadataProvider(eq(idpConfiguration.getMetadataLocation()));
verify(configurer).createDefaultExtendedMetadataDelegate(any(ResourceBackedMetadataProvider.class), any());
verify(metadataManagerProperties).getDefaultIdp();
verify(metadataManagerProperties).getHostedSpName();
verify(metadataManagerProperties).getRefreshCheckInterval();
verify(extendedMetadataDelegateProperties).isForceMetadataRevocationCheck();
verify(extendedMetadataDelegateProperties).isMetadataRequireSignature();
verify(extendedMetadataDelegateProperties).isMetadataTrustCheck();
verify(extendedMetadataDelegateProperties).isRequireValidMetadata();
verify(extendedMetadataDelegateProperties).getMetadataTrustedKeys();
List<MetadataProvider> providers = providersCaptor.getValue();
assertThat(providers).hasSize(1);
assertThat(providers.get(0)).isExactlyInstanceOf(ExtendedMetadataDelegate.class);
assertThat(((ExtendedMetadataDelegate) providers.get(0)).getDelegate()).isEqualTo(provider);
}
示例9: configure_defaults_withProviderDelegate
import org.springframework.security.saml.metadata.MetadataManager; //导入依赖的package包/类
@Test
public void configure_defaults_withProviderDelegate() throws Exception {
MetadataManagerConfigurer configurer = spy(new MetadataManagerConfigurer());
CachingMetadataManager metadataManager = mock(CachingMetadataManager.class);
when(configurer.createDefaultMetadataManager()).thenReturn(metadataManager);
configurer.setBuilder(builder);
MetadataProvider provider = mock(ExtendedMetadataDelegate.class);
configurer.metadataProvider(provider);
configurer.init(builder);
configurer.configure(builder);
verify(builder).setSharedObject(eq(MetadataManager.class), eq(metadataManager));
ArgumentCaptor<List> providersCaptor = ArgumentCaptor.forClass(List.class);
verify(metadataManager).setProviders((List<MetadataProvider>) providersCaptor.capture());
verify(configurer, never()).createDefaultMetadataProvider(eq(idpConfiguration.getMetadataLocation()));
verify(configurer, never()).createDefaultExtendedMetadataDelegate(any(ResourceBackedMetadataProvider.class), any());
verify(metadataManagerProperties).getDefaultIdp();
verify(metadataManagerProperties).getHostedSpName();
verify(metadataManagerProperties).getRefreshCheckInterval();
verify(extendedMetadataDelegateProperties, never()).isForceMetadataRevocationCheck();
verify(extendedMetadataDelegateProperties, never()).isMetadataRequireSignature();
verify(extendedMetadataDelegateProperties, never()).isMetadataTrustCheck();
verify(extendedMetadataDelegateProperties, never()).isRequireValidMetadata();
verify(extendedMetadataDelegateProperties, never()).getMetadataTrustedKeys();
List<MetadataProvider> providers = providersCaptor.getValue();
assertThat(providers).hasSize(1);
assertThat(providers.get(0)).isEqualTo(provider);
assertThat(((ExtendedMetadataDelegate) providers.get(0)).getDelegate()).isNull();
}
示例10: configure_defaults_withProviderLocation
import org.springframework.security.saml.metadata.MetadataManager; //导入依赖的package包/类
@Test
public void configure_defaults_withProviderLocation() throws Exception {
MetadataManagerConfigurer configurer = spy(new MetadataManagerConfigurer());
CachingMetadataManager metadataManager = mock(CachingMetadataManager.class);
when(configurer.createDefaultMetadataManager()).thenReturn(metadataManager);
configurer.setBuilder(builder);
configurer.metadataLocations("classpath:idp-provided.xml");
configurer.init(builder);
configurer.configure(builder);
verify(builder).setSharedObject(eq(MetadataManager.class), eq(metadataManager));
ArgumentCaptor<List> providersCaptor = ArgumentCaptor.forClass(List.class);
verify(metadataManager).setProviders((List<MetadataProvider>) providersCaptor.capture());
verify(configurer).createDefaultMetadataProvider(eq("classpath:idp-provided.xml"));
verify(configurer).createDefaultExtendedMetadataDelegate(any(ResourceBackedMetadataProvider.class), any());
verify(metadataManagerProperties).getDefaultIdp();
verify(metadataManagerProperties).getHostedSpName();
verify(metadataManagerProperties).getRefreshCheckInterval();
verify(extendedMetadataDelegateProperties).isForceMetadataRevocationCheck();
verify(extendedMetadataDelegateProperties).isMetadataRequireSignature();
verify(extendedMetadataDelegateProperties).isMetadataTrustCheck();
verify(extendedMetadataDelegateProperties).isRequireValidMetadata();
verify(extendedMetadataDelegateProperties).getMetadataTrustedKeys();
List<MetadataProvider> providers = providersCaptor.getValue();
assertThat(providers).hasSize(1);
assertThat(providers.get(0)).isExactlyInstanceOf(ExtendedMetadataDelegate.class);
assertThat(((ExtendedMetadataDelegate) providers.get(0)).getDelegate()).isExactlyInstanceOf(ResourceBackedMetadataProvider.class);
}
示例11: getMetadataManager
import org.springframework.security.saml.metadata.MetadataManager; //导入依赖的package包/类
public MetadataManager getMetadataManager() {
return metadataManager;
}
示例12: MetadataManagerConfigurer
import org.springframework.security.saml.metadata.MetadataManager; //导入依赖的package包/类
public MetadataManagerConfigurer(MetadataManager metadataManager) {
this.metadataManager = metadataManager;
}
示例13: setMetadata
import org.springframework.security.saml.metadata.MetadataManager; //导入依赖的package包/类
/**
* Metadata manager provides information about all available IDP and SP entities.
*
* @param metadata metadata manager
*/
@Override
@Autowired(required = false)
public void setMetadata(MetadataManager metadata) {
super.setMetadata(metadata);
}
开发者ID:ulisesbocchio,项目名称:spring-boot-security-saml,代码行数:11,代码来源:DSLWebSSOProfileConsumerHoKImpl.java
示例14: setMetadata
import org.springframework.security.saml.metadata.MetadataManager; //导入依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
@Autowired(required = false)
public void setMetadata(MetadataManager metadata) {
super.setMetadata(metadata);
}
示例15: configure_arguments
import org.springframework.security.saml.metadata.MetadataManager; //导入依赖的package包/类
@Test
public void configure_arguments() throws Exception {
MetadataManagerConfigurer configurer = spy(new MetadataManagerConfigurer());
CachingMetadataManager metadataManager = mock(CachingMetadataManager.class);
when(configurer.createDefaultMetadataManager()).thenReturn(metadataManager);
ResourceBackedMetadataProvider provider = mock(ResourceBackedMetadataProvider.class);
doReturn(provider).when(configurer).createDefaultMetadataProvider("classpath:idp-provided.xml");
ExtendedMetadataDelegate delegate = mock(ExtendedMetadataDelegate.class);
doReturn(delegate).when(configurer).createDefaultExtendedMetadataDelegate(eq(provider), any(ExtendedMetadata.class));
MetadataFilter metadataFilter = mock(MetadataFilter.class);
configurer.setBuilder(builder);
configurer
.metadataLocations("classpath:idp-provided.xml")
.defaultIDP("default")
.hostedSPName("spname")
.refreshCheckInterval(999L)
.forceMetadataRevocationCheck(true)
.metadataRequireSignature(true)
.metadataTrustCheck(true)
.requireValidMetadata(true)
.metadataTrustedKeys("one", "two")
.metadataFilter(metadataFilter);
configurer.init(builder);
configurer.configure(builder);
verify(builder).setSharedObject(eq(MetadataManager.class), eq(metadataManager));
ArgumentCaptor<List> providersCaptor = ArgumentCaptor.forClass(List.class);
verify(metadataManager).setProviders((List<MetadataProvider>) providersCaptor.capture());
verify(configurer).createDefaultMetadataProvider(eq("classpath:idp-provided.xml"));
verify(configurer).createDefaultExtendedMetadataDelegate(eq(provider), any());
verify(metadataManagerProperties, never()).getDefaultIdp();
verify(metadataManagerProperties, never()).getHostedSpName();
verify(metadataManagerProperties, never()).getRefreshCheckInterval();
verify(extendedMetadataDelegateProperties, never()).isForceMetadataRevocationCheck();
verify(extendedMetadataDelegateProperties, never()).isMetadataRequireSignature();
verify(extendedMetadataDelegateProperties, never()).isMetadataTrustCheck();
verify(extendedMetadataDelegateProperties, never()).isRequireValidMetadata();
verify(extendedMetadataDelegateProperties, never()).getMetadataTrustedKeys();
List<MetadataProvider> providers = providersCaptor.getValue();
assertThat(providers).hasSize(1);
assertThat(providers.get(0)).isEqualTo(delegate);
verify(metadataManager).setDefaultIDP(eq("default"));
verify(metadataManager).setHostedSPName(eq("spname"));
verify(metadataManager).setRefreshCheckInterval(eq(999L));
verify(delegate).setForceMetadataRevocationCheck(eq(true));
verify(delegate).setMetadataRequireSignature(eq(true));
verify(delegate).setMetadataTrustCheck(eq(true));
verify(delegate).setMetadataTrustedKeys((Set<String>) argThat(contains("one", "two")));
verify(delegate).setRequireValidMetadata(eq(true));
verify(delegate).setMetadataFilter(eq(metadataFilter));
}