我遇到了一個嚴重的問題,我似乎無法解決。我一直在使用spring boot示例:https://github.com/vdenotaris/spring-boot-security-saml-sample來集成一個新的SP。使用HttpMetaDataProvider時一切都很順利,但最近我不得不更改爲使用FileSystemMetadataProvider,並且事情進展不順利。Spring的SAML MetadataManage在ArtifactResolutionProfileBase中爲空,但元數據加載正確
我所有的元數據的似乎是正確加載,但是當我做了一個認證請求我越來越:
org.springframework.security.saml.websso.ArtifactResolutionProfileBase.resolveArtifact(ArtifactResolutionProfileBase.java:77)
我已經調試過這個問題,它看起來像MetadataManager在ArtifactResolutionProfileBase中爲null,但是,我不知道爲什麼,我只是卡住了!
這裏是我的配置:
// Setup advanced info about metadata
@Bean
@Qualifier("idp-extended-metadata")
public ExtendedMetadata idpExtendedMetadata() {
ExtendedMetadata extendedMetadata = new ExtendedMetadata();
return extendedMetadata;
}
// Setup advanced info about metadata
@Bean
@Qualifier("sp-extended-metadata")
public ExtendedMetadata spExtendedMetadata() {
ExtendedMetadata extendedMetadata = new ExtendedMetadata();
//sp meta data needs local set
extendedMetadata.setLocal(true);
extendedMetadata.setIdpDiscoveryEnabled(false);
extendedMetadata.setIdpDiscoveryResponseURL(environment.getProperty("sp.base.url"));
extendedMetadata.setSignMetadata(false);
extendedMetadata.setSigningKey("student-saml");
extendedMetadata.setEncryptionKey("student-saml");
extendedMetadata.setRequireArtifactResolveSigned(false);
extendedMetadata.setRequireLogoutRequestSigned(false);
extendedMetadata.setRequireLogoutResponseSigned(false);
return extendedMetadata;
}
@Bean
@Qualifier("ccc-idp")
public ExtendedMetadataDelegate CCCIdpExtendedMetadataProvider()
throws MetadataProviderException, IOException {
DefaultResourceLoader loader = new DefaultResourceLoader();
Resource metadatafile = loader.getResource("classpath:" + environment.getProperty("ccc.idp.metadatafile"));
FilesystemMetadataProvider filesystemMetadataProvider = new FilesystemMetadataProvider(metadatafile.getFile());
filesystemMetadataProvider.setParserPool(parserPool());
ExtendedMetadataDelegate extendedMetadataDelegate =
new ExtendedMetadataDelegate(filesystemMetadataProvider, idpExtendedMetadata());
extendedMetadataDelegate.setMetadataTrustCheck(false);
extendedMetadataDelegate.setMetadataRequireSignature(false);
extendedMetadataDelegate.initialize();
return extendedMetadataDelegate;
}
@Bean
@Qualifier("student-sp-metadata")
public ExtendedMetadataDelegate studentSPMetadata()
throws MetadataProviderException, IOException {
DefaultResourceLoader loader = new DefaultResourceLoader();
Resource metadatafile = loader.getResource("classpath:" + environment.getProperty("student.sp.metadatafile"));
FilesystemMetadataProvider filesystemMetadataProvider = new FilesystemMetadataProvider(metadatafile.getFile());
filesystemMetadataProvider.setParserPool(parserPool());
ExtendedMetadataDelegate extendedMetadataDelegate =
new ExtendedMetadataDelegate(filesystemMetadataProvider, spExtendedMetadata());
extendedMetadataDelegate.setMetadataTrustCheck(false);
extendedMetadataDelegate.setMetadataRequireSignature(false);
extendedMetadataDelegate.initialize();
return extendedMetadataDelegate;
}
// Do not forget to call iniitalize method on providers
@Bean
@Qualifier("metadata")
public MetadataManager metadata() throws MetadataProviderException, IOException {
List<MetadataProvider> providers = new ArrayList<MetadataProvider>();
ExtendedMetadataDelegate spMeta = studentSPMetadata();
ExtendedMetadataDelegate idpMeta = CCCIdpExtendedMetadataProvider();
providers.add(idpMeta);
providers.add(spMeta);
MetadataManager meta = new MetadataManager(providers);
meta.setHostedSPName(environment.getProperty("sp.entity.id"));
meta.setKeyManager(keyManager());
return meta;
}
任何幫助將不勝感激!