Skip to content

Commit

Permalink
Make IdpMetadataParser#get_idp_metadata public
Browse files Browse the repository at this point in the history
I have a use-case for being able to cache the intermediate fetch of
metadata in case of temporary failures, so rather than:

    parser.parse_remote(url)

I'd like to

    begin
      metadata = parser.get_idp_metadata(url, true)
      do_my_caching(metadata)
      parser.parse(metadata)
    rescue HttpError
      load_cache
    end

There's a fair amount of logic in the get_idp_metadata method that I'd
rather not need to re-implement. Right now I have this implemented with
`parser.send(:get_idp_metadata, url, true)` which is obviously not great
if the internals of this class change in the future. Can we move this
method to the public API?
  • Loading branch information
calebhearth committed Jul 8, 2024
1 parent f40c59b commit 43b0bb6
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/onelogin/ruby-saml/idp_metadata_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,6 @@ def parse_to_idp_metadata_array(idp_metadata, options = {})
idpsso_descriptors.map {|id| IdpMetadata.new(id, id.parent.attributes["entityID"])}
end

private

# Retrieve the remote IdP metadata from the URL or a cached copy.
# @param url [String] Url where the XML of the Identity Provider Metadata is published.
# @param validate_cert [Boolean] If true and the URL is HTTPs, the cert of the domain is checked.
Expand Down Expand Up @@ -220,6 +218,8 @@ def get_idp_metadata(url, validate_cert)
)
end

private

class IdpMetadata
attr_reader :idpsso_descriptor, :entity_id

Expand Down

0 comments on commit 43b0bb6

Please sign in to comment.