saml-idp / saml_idp

Ruby SAML Identity Provider, best used with Rails (though not required)
MIT License
263 stars 181 forks source link

normalize Encryptor cert handling #170

Closed kellyredding closed 2 weeks ago

kellyredding commented 3 years ago

This ensures the given opts[:cert] is formatted as expected in the constructor. This removes the need for a type-check in the openssl_cert method and DRYs up removing any /-+(BEGIN|END) CERTIFICATE-+/ processing. This means you can pass in opts[:cert] values in e.g. this form

-----BEGIN CERTIFICATE-----
ABC123...
-----END CERTIFICATE-----

and not get an OpenSSL::X509::CertificateError nested asn1 error exception when calling openssl_cert.

kellyredding commented 3 years ago

Note: there were a bunch of trailing whitespace in this file my editor auto-removed. Let me know if you want me to take that out of the PR.

This is my first PR here so let me know if something more is needed. Thanks for considering!

kellyredding commented 3 years ago

Hey, just a friendly ping on this. Any thoughts @jphenow ? Not sure who to contact about PRs on this repo. Thanks.

jphenow commented 3 years ago

Heya - yea I don't get to invest all that much time in this these days but this seems like a reasonable change. Can you toss in some tests to the existing encryptor tests in spec/? I think that'll help illustrate/prove this a bit.

Thanks for the addition!

Zogoo commented 2 weeks ago

I’m closing this pull request since this can be done on the application side, and the pull request is quite old.