-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Should SAML metadata EntityDescriptor tag have the md:
prefix?
#11283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
@ClaudioConsolmagno, thanks for the report. I wonder if the error is here: EntityDescriptor entityDescriptor = build(EntityDescriptor.ELEMENT_QNAME); It seems to me that it should be: EntityDescriptor entityDescriptor = build(EntityDescriptor.DEFAULT_ELEMENT_NAME); Would you be able to provide a PR of the |
The change you suggested is exactly what we had for our previous work around where we copied the whole OpenSamlMetadataResolver.java class (as it's final) in order to change this one line. Sure, will have a look at making this change PR. |
Glad to hear!
I'm sorry that you ended up copying the class; I imagine we'll be able to backport this fix, so it shouldn't be for long. I'm hearing a little bit of surprise in your comment about the fact that the class is final, so this might be a good place to reinforce Spring Security's design philosophy. Generally speaking, Spring Security only opens up classes when doing so simplifies customization. What we don't want to do is open a class for the primary purpose of giving an escape hatch to workaround a bug. When we do that, bugs live for a longer time in the code, which isn't ideal. Given that, many classes begin as final in Spring Security, waiting for a time when there is a clear use case that is best solved by opening it for extension. |
No, I'm not surprised at all! I just wanted to give you (or anyone else reading this) context on why I ended up going to great lengths for this one change. I understand why you'd want to keep the class final and support you on that. I just wished I would have opened this ticket sooner when I first came across this issue. I was reluctant on doing this until I was sure 100% there was no other way or if there was something else I was missing. I finally got time to spend on it this week with our Spring Boot 2.7 + Spring Security OAuth decommissioning (migration to Spring Auth Server) work. I never contributed to Spring before so will take some time to set it up and make the PR this weekend. |
Have created the PR now: #11300 |
Create the EntityDescriptor object with EntityDescriptor.DEFAULT_ELEMENT_NAME instead of EntityDescriptor.ELEMENT_QNAME. That ensures the EntityDescriptor tag is marshalled to xml with the 'md:' prefix, consistent with all other metadata tags. Closes #11283
Create the EntityDescriptor object with EntityDescriptor.DEFAULT_ELEMENT_NAME instead of EntityDescriptor.ELEMENT_QNAME. That ensures the EntityDescriptor tag is marshalled to xml with the 'md:' prefix, consistent with all other metadata tags. Closes #11283
Create the EntityDescriptor object with EntityDescriptor.DEFAULT_ELEMENT_NAME instead of EntityDescriptor.ELEMENT_QNAME. That ensures the EntityDescriptor tag is marshalled to xml with the 'md:' prefix, consistent with all other metadata tags. Closes #11283
Create the EntityDescriptor object with EntityDescriptor.DEFAULT_ELEMENT_NAME instead of EntityDescriptor.ELEMENT_QNAME. That ensures the EntityDescriptor tag is marshalled to xml with the 'md:' prefix, consistent with all other metadata tags. Closes #11283
Create the EntityDescriptor object with EntityDescriptor.DEFAULT_ELEMENT_NAME instead of EntityDescriptor.ELEMENT_QNAME. That ensures the EntityDescriptor tag is marshalled to xml with the 'md:' prefix, consistent with all other metadata tags. Closes #11283
Expected Behavior
All tags in the metadata xml have
md:
or other appropriate prefixes, except for theEntityDescriptor
tag. For consistency purposes and better integration with other services, it should be changed to include themd:
prefix. E.g.:Current Behavior
The default metadata xml file contains an EntityDescriptor tag without the
md:
prefix. E.g.:Context
How has this issue affected you? / What are you trying to accomplish?

Consuming the current metadata file in Azure fails. From testing, Azure fails to process the metadata file when prefixed
md:
tags are mixed with non-prefixed tags. The fix is to either addmd:
prefix to EntityDescriptor tag or to remove all tags that have themd:
prefix.Are you aware of any workarounds?
We use Spring Boot 2.7.0 so we are on the latest Spring Security version 5.7.1. Our current workaround is to use the setEntityDescriptorCustomizer() method:
This isn't too bad of a workaround but should we be doing this? In any case, this is better than the workaround we had for previous Spring Boot/Security versions where we had to copy the whole
OpenSamlMetadataResolver
class (as it's final) and change a single line of code.Additional Information
The text was updated successfully, but these errors were encountered: