Describe the bug I am using spring security 5.8.5 and trying to get the metadata filter working. I am following the instructions from here https://docs.spring.io/spring-security/reference/5.8/servlet/saml2/metadata.html#publishing-relying-party-metadata

DefaultRelyingPartyRegistrationResolver relyingPartyRegistrationResolver =
        new DefaultRelyingPartyRegistrationResolver(this.relyingPartyRegistrationRepository);
Saml2MetadataFilter filter = new Saml2MetadataFilter(
        relyingPartyRegistrationResolver,
        new OpenSamlMetadataResolver());

http
    // ...
    .saml2Login(withDefaults())
    .addFilterBefore(filter, Saml2WebSsoAuthenticationFilter.class);

But on service start up, I get the error -

Caused by: java.lang.IllegalArgumentException: The Filter class org.springframework.security.saml2.provider.service.web.authentication.Saml2WebSsoAuthenticationFilter does not have a registered order

I am not sure how to get past this problem. Any help is much appreciated? thanks!

To Reproduce Steps to reproduce the behavior.

Expected behavior SAML2MetadataFilter is added and metadata can be retrieved.

Sample n/a

Reports that include a sample will take priority over reports that do not. At times, we may require a sample, so it is good to try and include a sample up front.

Comment From: rahul-mishra-sp

I was able to solve this by using the deprecated filter in .addFilterBefore org.springframework.security.saml2.provider.service.servlet.filter.Saml2WebSsoAuthenticationFilter instead of org.springframework.security.saml2.provider.service.web.authentication.Saml2WebSsoAuthenticationFilter