Wstunes / SwiftyJWT

A library to generate JWT with Swift
MIT License
48 stars 30 forks source link

Fix support for rs384 and rs512. #5

Closed frimicc closed 6 years ago

frimicc commented 6 years ago

There was a bug in the code so that it used .sha256 for all RSA digest work. I've modified the code to make the digest type a parameter, so that the other options will also work.

I also added support for nil expiration dates, which aren't a good idea, but my team needs.

I hope it's OK that I am suggesting these changes! Please let me know if you would prefer I report this another way.

Wstunes commented 6 years ago

Thanks for your contribution. However, a nil expiration date is always weird. But let's support it now.

frimicc commented 6 years ago

Shoot, I didn't realize that you have to do extra stuff to update the version in the Cocoapods repo. Can you following the "Release" instructions when you get a chance? https://guides.cocoapods.org/making/making-a-cocoapod.html#release

Thanks again! Great work on this module, too. It's a big help!

Wstunes commented 6 years ago

A nil expiration is a extreme case. The code in JWT.swift should be try self.payload.checkExpiration(allowNil: false) in which you set the expiration check ignored by default. You can extend a method to ignore the expiration check instead of ignoring globally. I'll update the version after your new commit.