kylef / JSONWebToken.swift

Swift implementation of JSON Web Token (JWT).
http://jwt.io
BSD 2-Clause "Simplified" License
763 stars 225 forks source link

Implement leeway for date validation #83

Closed JanBrinker closed 7 years ago

JanBrinker commented 7 years ago

@kylef I implemented the leeway as discussed by optional function parameters. This way there are no code breakages.

I also added unit tests for each date validation (both cases: fail without leeway and success with leeway) and added two small integration tests to check whether the leeway is passed through all calls down to the validators.

JanBrinker commented 7 years ago

@kylef do you have any clue why XCTestExpectation can't be initialized on Linux the way it is initialized on macOS? That's currently causing the build fails and I can't debug on Linux..

kylef commented 7 years ago

I do not think XCTestExpectation is available on Linux, this is because the test running is a lot different. I do not believe there is a run loop created and thus the type of behaviour of XCTestExpectation doesn't make sense.

XCTestExpectation is for asynchronous testing and these tests are not asynchronous, you should be able to remove the use of XCTestExpectation simply.

JanBrinker commented 7 years ago

Any clue why Travis is complaining? It says it can't find the build logs for macOS..

JanBrinker commented 7 years ago

@kylef checks are through. If you agree with my implementation it would be great to have the PR accepted 👍

kylef commented 7 years ago

Any clue why Travis is complaining? It says it can't find the build logs for macOS. Hit rebuild and seems to work, I think it was Travis flakiness.

I think this is good, I'll give it a review soon and make a release incorporating these changes.

Can you add an entry in CHANGELOG.md describing your changes please?

kylef commented 7 years ago

Might be good to add a note about this in the README.md so other people coming into JSONWebToken are aware of the leeway argument.

JanBrinker commented 7 years ago
kylef commented 7 years ago

Awesome, nice work here @JanBrinker. I appreciate the pull request.