spring saml security中使用的stactic sp元数据文件未下载

1dkrff03  于 2021-09-30  发布在  Java
关注(0)|答案(0)|浏览(207)

我使用SpringSAML安全性并使用注解来提供sp元数据文件。当我尝试使用下载sp元数据文件时,我能够执行ssohttp://localhost//saml/metadata 正在下载默认sp元数据文件,而不是本地文件。我没有使用任何metadatageneratorfilter来提供sp元数据xml

@Bean
@DependsOn("parserPool")
public ExtendedMetadataDelegate spMetadataDelegate() throws MetadataProviderException, ResourceException {

    Timer backgroundTaskTimer = new Timer(true);

    ResourceBackedMetadataProvider resourceBackedMetadataProvider = new ResourceBackedMetadataProvider(backgroundTaskTimer,
            new FilesystemResource("<path-to-local-sp.xml>"));

    resourceBackedMetadataProvider.setParserPool(parserPool());
    resourceBackedMetadataProvider.initialize();
    ExtendedMetadataDelegate extendedMetadataDelegate = new ExtendedMetadataDelegate(resourceBackedMetadataProvider, spExtendedMetadata());
    return extendedMetadataDelegate;
}

@Bean
public ExtendedMetadata spExtendedMetadata()
{
    ExtendedMetadata extendedMetadata = new ExtendedMetadata();           
    extendedMetadata.setLocal(true);
    extendedMetadata.setAlias("metadataAlias");
    return extendedMetadata;
}

@Bean
public ExtendedMetadataDelegate spExtendedMetadataProvider() throws MetadataProviderException 
{
    File metadata = null;
    try 
    {
        metadata = new File(spMetadataFile);
    }
    catch (Exception e) 
    {
        Debug.println(Debug.INFO, "unable to read sp metadata file from "+ spMetadataFile);
    }
    FilesystemMetadataProvider provider = new FilesystemMetadataProvider(metadata);
    provider.setParserPool(parserPool());
    return new ExtendedMetadataDelegate(provider, spExtendedMetadata());
}

@Bean
@Qualifier("metadata")
public CachingMetadataManager metadata() throws MetadataProviderException, ResourceException 
{
    List<MetadataProvider> providers = new ArrayList<>();
    providers.add(spExtendedMetadataProvider());

    CachingMetadataManager metadataManager = new CachingMetadataManager(providers);
    metadataManager.setDefaultIDP(defaultIdp);
    return metadataManager;
}

也可以使用我们自己的登录、元数据和注销url而不是默认url。

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题