Skip to content

Allow customization of single logout in auto-configured SAML relying party registration #30128

Closed
@ugrave

Description

@ugrave

Currently a auto configured relying party registration cannot be modified afterwards.

In my case i configured a ssaml single logout url via Spring Security. But i cannot set the configured logout url to autoconfigured RelyingPartyRegistration.singleLogoutServiceLocation.

  @Bean
  SecurityFilterChain securityFilterChain(HttpSecurity http, RelyingPartyRegistrationRepository relyingPartyRegistrationRepository) throws Exception {
    RelyingPartyRegistrationResolver relyingPartyRegistrationResolver = new DefaultRelyingPartyRegistrationResolver(relyingPartyRegistrationRepository);
    Saml2MetadataFilter metadataFilter = new Saml2MetadataFilter(relyingPartyRegistrationResolver, new OpenSamlMetadataResolver());
    return http
      .saml2Login(Customizer.withDefaults())
      .saml2Logout(Customizer.withDefaults())
      .addFilterBefore(
        metadataFilter,
        Saml2WebSsoAuthenticationFilter.class
      )
      .build();
  }

I add the Saml2MetadataFilter filter together with the OpenSamlMetadataResolver to make the relying party metadata available.
The OpenSamlMetadataResolver use the data from the RelyingPartyRegistration.
Problem is know that the logout url is not part of the metadata because its not set in the RelyingPartyRegistration.

A solution could be to provide a way to customize the autoconfigured RelyingPartyRegistration before is is created.
Same think as it already exist for the RestTemplate with the RestTemplateCustomizer.

My current workaround is to skip the autocinfiguration and create and register the RelyingPartyRegistration by myself with my own RelyingPartyRegistrationRepository bean.

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions