Implement IdpMetadataParser#parse_to_hash#393
Implement IdpMetadataParser#parse_to_hash#393pitbulk merged 2 commits intoSAML-Toolkits:key_rollover_mngmtfrom
Conversation
and IdpMetadataParser#parse_remote_to_hash. Having the parsed metadata as Hash may be useful for configuring omniauth-saml, for instance.
***Do not merge into master before SAML-Toolkits/ruby-saml#393 is in their master.***
|
I briefly considered changing the interface of the IdpMetadataParser even further: parser = OneLogin::RubySaml::IdpMetadataParser::FromString.new(xml_string, parse_options)
# or
parser = OneLogin::RubySaml::IdpMetadataParser::FromURL.new(url, parse_options)
# or maybe even
parser = OneLogin::RubySaml::IdpMetadataParser::FromFile.new(url, parse_options)
# maybe with some helper class methods:
parser = OneLogin::RubySaml::IdpMetadataParser.new_for_string(xml_string, parse_options)
# etc.
parser.to_settings # returns OneLogin::RubySaml::Settings
parser.to_hash # returns an Hashwhile this would be an imho cleaner interface (and avoids the side effects of setting instance variables in the current |
|
Nice work, related to the rename that you mentioned here, rest of toolkits already uses the same name convention, so at the end is complex to apply a change like that. Reviewing your PR, I noticed that we renamed options by parse_options. I think we need to rename it back to options, since it can contains parse_options, but also a settings object.
What do you think? |
|
@pitbulk I've updated the PR accordingly. I was not sure about all the |
4e30b0a to
ee0ce5b
Compare
|
I think now is perfect |
This adds two options, `:idp_metadata_url` and `:idp_metadata_xml`. Both options can be used to set other options based on the metadata the IdP provides. While the first option fetches the metadata from a remote URL, the second one uses an XML string. Fetching and/or parsing the metadata is done when the strategy is initialized and not for each request. This implements omniauth#83
…and IdpMetadataParser#parse_remote_to_hash.
Having the parsed metadata as Hash may be useful for configuring omniauth-saml, for instance. See omniauth/omniauth-saml#135