-
Notifications
You must be signed in to change notification settings - Fork 43
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
None of my SingleLogoutSerivce elements in metadata xml files seem to be getting parsed #46
Comments
Actually, for THAT metadata xml, the SingleLogoutService elements are NOT deserialized at all. There seems to be two problems here; sometimes the elements aren't deserialized, and then when they are they have the wrong Type property values. |
IdentityProviderEndpoint is part of the configuration namespace. The "Type" only has meaning when used as part of configuration parsing, when it has to split up the identity provider endpoints by type. Here, the type is provided explicitly by the XML element name, so when it splits the endpoints it doesn't actually set Type. Arguably, it would be a good idea if it DID set it here just to avoid confusion, though it isn't used. |
Ok. How about the problem with the logout element not being deserialized at all? Any thoughts on that? It might be specific to this xml file, because some others I've tried do seem to work. Could there be an issue with the Location being the same for both signon and logout? |
Nope, that looks right to me. I don't see a reason it wouldn't deserialize. |
I figured out the problem. I had to fix the xml by moving the SingleLogoutService element to before the NameIDFormat element. (This xml was provided by the identity provider; it wasn't hand-coded.) In SAML2.Schema.Metadata, the SsoDescriptor and IdpSsoDescriptor classes use To help debug this, I added an UnknownElement event handler to SAML2.Utils.Serialization.Deserialize. You might want to add logging for this situation, or even throw exceptions. I just had a breakpoint in the handler so I could look at the event object. public static T Deserialize<T>(XmlReader reader)
{
var serializer = new XmlSerializer(typeof(T));
serializer.UnknownElement += Serializer_UnknownElement;
var item = (T)serializer.Deserialize(reader);
return item;
}
private static void Serializer_UnknownElement(object sender, XmlElementEventArgs e)
{
} |
Been a while since I read the spec... https://www.oasis-open.org/committees/download.php/51890/SAML%20MD%20simplified%20overview.pdf If you go down to about page 8 for IDPSSODescriptor, it says this:
I considered removing the Order declarations for a minute, but it appears they are actually important... Your suggestion is probably a good one as I can't think of a better way to indicate that you have an invalid metadata document if it is gonna silently ignore things like this. If you feel like submitting a PR to log a warning in this case, Ill review it. You can grab a current logger instance and send a Warning as below. Just mention this ticket in the commit.
|
I'm testing with a few Idps, which are configured using metadata xml files, like the one below. During configuration loading, Init() is called, which calls IdentityProviderCollection.Refresh(), which calls ParseFile() for each file, which calls LoadFileAsXmlDocument(). Finally, the doc object is passed to Saml20MetadataDocument's constructor which calls DeserializeFromXmlString.
At that point the deserialized object contains the logout endpoints, but when control returns back to the file loop in IdentityProviderCollection, the metadataDoc objects have IDPSLOEndpoints objects whose Type is set to SignOn instead of Logout. They seem to be uninitialized rather than explicitly set incorrectly, but I can't figure out where that should be fixed.
The text was updated successfully, but these errors were encountered: