当前位置: 首页>>代码示例>>Java>>正文


Java EmptyKeyManager类代码示例

本文整理汇总了Java中org.springframework.security.saml.key.EmptyKeyManager的典型用法代码示例。如果您正苦于以下问题:Java EmptyKeyManager类的具体用法?Java EmptyKeyManager怎么用?Java EmptyKeyManager使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


EmptyKeyManager类属于org.springframework.security.saml.key包,在下文中一共展示了EmptyKeyManager类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: generate

import org.springframework.security.saml.key.EmptyKeyManager; //导入依赖的package包/类
public MetadataProvider generate(final SAMLConfig configuration) throws ServletException, MetadataProviderException {

	    MetadataGenerator generator = new MetadataGenerator();
	    generator.setKeyManager(new EmptyKeyManager());

	    // Defaults
	    String alias = configuration.getAlias();
	    String baseURL = configuration.getBaseUrl();

	    generator.setEntityBaseURL(baseURL);
	    List<String> ssoBindings = new ArrayList<String>();
	    ssoBindings.add("post");
	    generator.setBindingsSSO(ssoBindings);

	    // Use default entityID if not set
	    if (generator.getEntityId() == null) {
	        generator.setEntityId(configuration.getSpEntityId());
	    }

	    Configuration.getGlobalSecurityConfiguration().getKeyInfoGeneratorManager().getManager("MetadataKeyInfoGenerator");

	    EntityDescriptor descriptor = generator.generateMetadata();
	    ExtendedMetadata extendedMetadata = generator.generateExtendedMetadata();
	    extendedMetadata.setRequireLogoutRequestSigned(false);
	    extendedMetadata.setSignMetadata(false);
	    extendedMetadata.setAlias(alias);

	    MetadataMemoryProvider memoryProvider = new MetadataMemoryProvider(descriptor);
	    memoryProvider.initialize();
	    MetadataProvider spMetadataProvider = new ExtendedMetadataDelegate(memoryProvider, extendedMetadata);

	    return spMetadataProvider;

	}
 
开发者ID:italia,项目名称:spid-spring,代码行数:35,代码来源:SpMetadataGenerator.java

示例2: testProperties

import org.springframework.security.saml.key.EmptyKeyManager; //导入依赖的package包/类
@Test
public void testProperties() throws Exception {
    KeyManagerConfigurer configurer = new KeyManagerConfigurer();
    configurer.init(builder);
    configurer.configure(builder);
    ArgumentCaptor<KeyManager> providerCaptor = ArgumentCaptor.forClass(KeyManager.class);
    verify(builder).setSharedObject(eq(KeyManager.class), providerCaptor.capture());
    assertThat(providerCaptor.getValue()).isNotNull();
    KeyManager keyManager = providerCaptor.getValue();
    assertThat(keyManager).isExactlyInstanceOf(EmptyKeyManager.class);
}
 
开发者ID:ulisesbocchio,项目名称:spring-boot-security-saml,代码行数:12,代码来源:KeyManagerConfigurerTest.java

示例3: keyManager

import org.springframework.security.saml.key.EmptyKeyManager; //导入依赖的package包/类
@Bean
public KeyManager keyManager() {

    if (!Strings.isNullOrEmpty(environment.getProperty("keystore.location"))) {
        try {
            Resource storeFile = new FileSystemResourceLoader().getResource(environment.getProperty("keystore.location"));

            String keystoreKey = environment.getProperty("keystore.key");
            String storePass = environment.getProperty("keystore.password");

            Map<String, String> passwords = new HashMap<>();

            passwords.put(keystoreKey, environment.getProperty("keystore.key.password"));

            KeyStore jceks = KeyStore.getInstance("JCEKS");

            jceks.load(storeFile.getInputStream(), storePass.toCharArray());
            return new JKSKeyManager(storeFile, storePass, passwords, keystoreKey);

        } catch (Exception e) {
            throw new RuntimeException(e);
        }
    } else {
        return new EmptyKeyManager();
    }

}
 
开发者ID:solita,项目名称:kansalaisaloite,代码行数:28,代码来源:WebSecurityConfig.java


注:本文中的org.springframework.security.saml.key.EmptyKeyManager类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。