Add samlmetadata Qualifier to Content Type

Closes gh-15147
This commit is contained in:
Josh Cummings 2024-06-21 12:56:38 -06:00
parent 78d2be9bd5
commit a529607d42
No known key found for this signature in database
GPG Key ID: A306A51F43B8E5A5
1 changed files with 2 additions and 3 deletions

View File

@ -1,5 +1,5 @@
/*
* Copyright 2002-2022 the original author or authors.
* Copyright 2002-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@ -26,7 +26,6 @@ import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.security.saml2.Saml2Exception;
import org.springframework.security.saml2.provider.service.metadata.Saml2MetadataResolver;
import org.springframework.security.saml2.provider.service.metadata.Saml2MetadataResponse;
@ -103,7 +102,7 @@ public final class Saml2MetadataFilter extends OncePerRequestFilter {
private void writeMetadataToResponse(HttpServletResponse response, Saml2MetadataResponse metadata)
throws IOException {
response.setContentType(MediaType.APPLICATION_XML_VALUE);
response.setContentType("application/samlmetadata+xml");
String format = "attachment; filename=\"%s\"; filename*=UTF-8''%s";
String fileName = metadata.getFileName();
String encodedFileName = URLEncoder.encode(fileName, StandardCharsets.UTF_8);