The registration id is concatenated into the Content-Disposition header:
response.setHeader(HttpHeaders.CONTENT_DISPOSITION,
"attachment; filename=\"saml-" + registrationId + "-metadata.xml\"");
However, this will not support international filenames. Additionally, there is the potential for bugs if the registration id contains an unexpected character like a quotation mark.
Following RFC 8187 like so would support more use cases:
String encodedRegistrationId = URLEncoder.encode(registrationId, StandardCharsets.UTF_8.name());
response.setHeader(HttpHeaders.CONTENT_DISPOSITION,
"attachment; filename*=UTF-8''saml-" + encodedRegistrationId + "-metadata.xml");