mgomes / api_auth

HMAC authentication for Rails and HTTP Clients
MIT License
480 stars 147 forks source link

Fall back to stripping out newlines on Ruby 1.8. #34

Closed Umofomia closed 10 years ago

Umofomia commented 10 years ago

22 introduced the use of Base64::strict_encode64 so that generated keys and signatures don't end up having newlines; however, Base64::strict_encode64 was introduced in Ruby 1.9. This adds the fallback handling for Ruby 1.8.

Umofomia commented 10 years ago

@mgomes It appears the Travis CI build is currently failing due to some setup issues in Travis CI with Ruby 2.0 rather than anything related to this branch.

mgomes commented 10 years ago

Thanks @Umofomia. I'll review this patch and get it merged soon. Still haven't figured out why Travis is failing on those rubies :smirk:

awendt commented 10 years ago

I've sent a pull request to run against different versions of Rails. Without this patch for 1.8, the build fails nicely with the corresponding message:

NoMethodError:
  undefined method `strict_encode64' for Base64:Module

I guess it makes sense to get the Travis CI build working (as I did in #35), then merge this patch?

awendt commented 10 years ago

Also, if there is code that adds a fallback for an older version of Ruby, we should test against 1.8 as well. That's not the case right now.

kjg commented 10 years ago

:+1: