Skip to content

Implement IdpMetadataParser#parse_to_hash#393

Merged
pitbulk merged 2 commits intoSAML-Toolkits:key_rollover_mngmtfrom
tosch:Parse_idp_metadata_into_an_hash
May 11, 2017
Merged

Implement IdpMetadataParser#parse_to_hash#393
pitbulk merged 2 commits intoSAML-Toolkits:key_rollover_mngmtfrom
tosch:Parse_idp_metadata_into_an_hash

Conversation

@tosch
Copy link
Copy Markdown

@tosch tosch commented May 10, 2017

…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

and IdpMetadataParser#parse_remote_to_hash.

Having the parsed metadata as Hash may be useful for configuring
omniauth-saml, for instance.
tosch pushed a commit to tosch/omniauth-saml that referenced this pull request May 10, 2017
***Do not merge into master before SAML-Toolkits/ruby-saml#393 is in their
master.***
@tosch
Copy link
Copy Markdown
Author

tosch commented May 10, 2017

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 Hash

while this would be an imho cleaner interface (and avoids the side effects of setting instance variables in the current #parse method), I did not implement that as it would break the current API. If you want to see that in a future major release — I'm happy to contribute that.

@pitbulk
Copy link
Copy Markdown
Collaborator

pitbulk commented May 11, 2017

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.
And update the parameter description that currently only mention the settings stuff:

@param options [Hash] :settings to provide the OneLogin::RubySaml::Settings object or an hash for Settings overrides

What do you think?

@tosch
Copy link
Copy Markdown
Author

tosch commented May 11, 2017

@pitbulk I've updated the PR accordingly. I was not sure about all the @options, so please review those descriptions carefully.

@tosch tosch force-pushed the Parse_idp_metadata_into_an_hash branch from 4e30b0a to ee0ce5b Compare May 11, 2017 10:09
@pitbulk
Copy link
Copy Markdown
Collaborator

pitbulk commented May 11, 2017

I think now is perfect

@pitbulk pitbulk merged commit 58dedaf into SAML-Toolkits:key_rollover_mngmt May 11, 2017
cappadona referenced this pull request in tosch/omniauth-saml Jun 6, 2017
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants