From 43b0bb61b710b15cbdc2298c8be5b6692897329b Mon Sep 17 00:00:00 2001 From: Caleb Hearth Date: Mon, 8 Jul 2024 09:19:43 -0600 Subject: [PATCH] Make IdpMetadataParser#get_idp_metadata public 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? --- lib/onelogin/ruby-saml/idp_metadata_parser.rb | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/onelogin/ruby-saml/idp_metadata_parser.rb b/lib/onelogin/ruby-saml/idp_metadata_parser.rb index d4205896..8a2e4ca2 100644 --- a/lib/onelogin/ruby-saml/idp_metadata_parser.rb +++ b/lib/onelogin/ruby-saml/idp_metadata_parser.rb @@ -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. @@ -220,6 +218,8 @@ def get_idp_metadata(url, validate_cert) ) end + private + class IdpMetadata attr_reader :idpsso_descriptor, :entity_id