onelogin/ruby-saml — pull request #175 by phlipper (2014-12-14 04:06:42+00:00)
Title: Introduce thread safety to SAML schema validation

Per the references below, use of `Dir.chdir` is not thread-safe. This usage was causing exceptions to be raised when running on Puma and in other multi-threaded environments.

This patch also moves the schema read up to a class instance, as this data is static and does not need to be read every time an assertion is validated. This boosts performance, especially in environments with higher throughput.

Thanks to @dannyb for the assistance!

References:

* https://www.ruby-forum.com/topic/165079
* https://bugs.ruby-lang.org/issues/9785
* http://www.justskins.com/forums/working-directory-in-thread-42304.html
* http://www.ruby-doc.org/core-2.1.5/Dir.html#method-c-chdir