本文整理汇总了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;
}
示例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);
}
示例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();
}
}