java—使用spring生成sp元数据文件期间的用户定义值

5jvtdoz2  于 2021-09-30  发布在  Java
关注(0)|答案(0)|浏览(325)

我正在尝试使用SpringSecuritySAMLBeans生成sp元数据文件,并能够在assertionconsumerservice和singlelogoutservice下设置默认值。有没有办法改变这些值?

//SP Metadata related stuff
@Bean
public MetadataGeneratorFilter metadataGeneratorFilter() 
{
    return new MetadataGeneratorFilter(metadataGenerator());
}

@Bean
public ExtendedMetadata spExtendedMetadata()
{
    ExtendedMetadata extendedMetadata = new ExtendedMetadata();           
    extendedMetadata.setSignMetadata(true);
    extendedMetadata.setRequireLogoutRequestSigned(true);
    extendedMetadata.setRequireLogoutResponseSigned(true);
    extendedMetadata.setEncryptionKey(keystoreId);
    extendedMetadata.setSigningAlgorithm(signingAlgorithm);
    return extendedMetadata;
}

@Bean
public MetadataGenerator metadataGenerator() 
{

    MetadataGenerator metadataGenerator = new MetadataGenerator();
    metadataGenerator.setId(spEntityId);
    metadataGenerator.setEntityId(spEntityId);
    metadataGenerator.setEntityBaseURL(spBaseUrl);
    metadataGenerator.setExtendedMetadata(spExtendedMetadata());
    metadataGenerator.setKeyManager(keyManager());
    metadataGenerator.setRequestSigned(false);
    metadataGenerator.setWantAssertionSigned(false);;
    metadataGenerator.setBindingsSLO(null);
    return metadataGenerator;
}

sp-metadata.xml

//Expected code    
    <md:SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="http://localhost:8000/saml/SingleLogout"/>
    <md:SingleLogoutService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Redirect" Location="http://localhost:8000/saml/SingleLogout"/>
    <md:NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:emailAddress</md:NameIDFormat>
    <md:NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:transient</md:NameIDFormat>
    <md:NameIDFormat>urn:oasis:names:tc:SAML:2.0:nameid-format:persistent</md:NameIDFormat>
    <md:NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:unspecified</md:NameIDFormat>
    <md:NameIDFormat>urn:oasis:names:tc:SAML:1.1:nameid-format:X509SubjectName</md:NameIDFormat>
    <md:AssertionConsumerService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-POST" Location="http://localhost:8000/saml/SSO" index="0" isDefault="true"/>
    <md:AssertionConsumerService Binding="urn:oasis:names:tc:SAML:2.0:bindings:HTTP-Artifact" Location="http://localhost:8000/saml/SSO" index="1"/><
    /md:SPSSODescriptor>

</md:entitydescriptor>
我希望在singlelogoutservice和assertionconsumerservice中获得不同的(我的应用程序所期望的)值。

暂无答案!

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

相关问题