Skip to content

Commit a529607

Browse files
committed
Add samlmetadata Qualifier to Content Type
Closes gh-15147
1 parent 78d2be9 commit a529607

File tree

1 file changed

+2
-3
lines changed
  • saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/web

1 file changed

+2
-3
lines changed

saml2/saml2-service-provider/src/main/java/org/springframework/security/saml2/provider/service/web/Saml2MetadataFilter.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2022 the original author or authors.
2+
* Copyright 2002-2024 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -26,7 +26,6 @@
2626
import jakarta.servlet.http.HttpServletResponse;
2727

2828
import org.springframework.http.HttpHeaders;
29-
import org.springframework.http.MediaType;
3029
import org.springframework.security.saml2.Saml2Exception;
3130
import org.springframework.security.saml2.provider.service.metadata.Saml2MetadataResolver;
3231
import org.springframework.security.saml2.provider.service.metadata.Saml2MetadataResponse;
@@ -103,7 +102,7 @@ protected void doFilterInternal(HttpServletRequest request, HttpServletResponse
103102

104103
private void writeMetadataToResponse(HttpServletResponse response, Saml2MetadataResponse metadata)
105104
throws IOException {
106-
response.setContentType(MediaType.APPLICATION_XML_VALUE);
105+
response.setContentType("application/samlmetadata+xml");
107106
String format = "attachment; filename=\"%s\"; filename*=UTF-8''%s";
108107
String fileName = metadata.getFileName();
109108
String encodedFileName = URLEncoder.encode(fileName, StandardCharsets.UTF_8);

0 commit comments

Comments
 (0)