Commit Graph

48 Commits

Author SHA1 Message Date
Michael Pfaff 4d8679a53b
cargo fmt 2022-03-06 12:27:27 -05:00
Michael Pfaff c562d2f22e
Use crosstime git instead of local 2022-03-06 12:17:15 -05:00
Michael Pfaff 86ba5e1d6c
Support for WASM 2022-02-27 23:24:26 -05:00
Vincent Prouillet 1a9ca38b76 Update leeway docs
Closes #234
2022-02-03 16:23:33 +01:00
Vivien Maisonneuve 0ed16a34ad Fix function name in doc comment 2022-02-03 13:08:21 +01:00
Pietro 03927bf319 reduced default double allocation to one (#232) 2022-02-02 22:10:11 +01:00
Vincent Prouillet 5486f96f52 Remove iat mention
Closes #228
2022-02-02 22:10:11 +01:00
Vincent Prouillet 255c740e47 Add required_spec_claims (#225) 2022-02-02 22:10:11 +01:00
Vincent Prouillet 356fac075d Fix validation for issuers 2022-02-02 22:10:11 +01:00
Vincent Prouillet 5ed8af440c Rename set_iss to be in line with set_audience 2022-02-02 22:10:11 +01:00
Vincent Prouillet c9c94c2b02 Change default leeway 2022-02-02 22:10:11 +01:00
emeryc 2cc95b9f37 Numeric type (#214)
* exp & nbf as float

In order to properly align with JWT NumericType wire protocol
allow for type on wire to either be u64 or f64. In either case we
convert in the most lossless way possible to a u64, so that nobody
needs to know that the spec is overly permissive.

* minimal cleanup
2022-02-02 22:10:11 +01:00
Vincent Prouillet 733d29aa87 Add back Validation::default()
Closes #208
2022-02-02 22:10:11 +01:00
Ten0 f9771f7835 Improve deserialization performance around validation and its tests (#202)
* Improve deserialization performance around validation and its tests

The claims validation was done via deserializing into a Map, which
implies allocations/deallocations. This was done even if the map was not
used afterwards.

This commit improves performance of the validation by never
deserializing in a `Map`, and deserializing only when necessary, to
a struct that typically only borrows from the original b64-decoded
json string.

The validation function interface change required update to the tests,
which are also made easier to read by using the `serde_json::json!`
macro.

* unrelated: fix bench compilation
2022-02-02 22:10:11 +01:00
Vincent Prouillet 1dcfda92f0 Unify various decode into the validation struct (#199) 2022-02-02 22:10:11 +01:00
Vincent Prouillet b6dafd63dd Make Validation::algorithms an error if empty 2022-02-02 22:10:11 +01:00
Saber Haj Rabiee f3566ecd82 clone-free validate function (#179)
* clone-free validate function

It could save up to 300ns in my benches
2022-02-02 22:10:11 +01:00
Saber Haj Rabiee d8cc36dd0c clone-free serde Value deserialization (#178)
* clone-free serde Value deserialization
2022-02-02 22:10:11 +01:00
Saber Haj Rabiee 9fd9db55cd Update validation.rs (#176) 2022-02-02 22:10:11 +01:00
Saber Haj Rabiee da761fe039 checking iss for multiple values (#173) 2022-02-02 22:10:11 +01:00
Vincent Prouillet 60c92f2882 Fix clippy 2022-02-02 22:10:11 +01:00
Vincent Prouillet 2c9c57fc4b Expose get_current_timestamp
Closes #152
2022-02-02 22:10:11 +01:00
Piotr Maks 90b9700748
Clippy (#146)
* Bump minimum required Rust version to 1.40

Motivation for this change is use of `#[non_exhaustive]` attribute that
was stabilized in Rust 1.40.0

* Migrate benchmarks to criterion

Remove use of unstable features in favour of criterion benchmarks

* Enable clippy in Github Actions

* Fix clippy::manual_non_exhaustive

Remove manual implementations of the non-exhaustive pattern. Instead
use the `#[non_exhaustive]` attribute.

* Allow reexport of deprecated function

Silence rustc `deprecated` working in function reexport

* Remove redundant clone

* Fix various clippy warnings

* Remove redundant pattern
* Use `unreachable!()` to fail test
* No need to add `&` to all patterns
2020-08-31 12:04:57 +02:00
Vincent Prouillet 0abeeac25f Add EncodingKey 2019-12-29 19:33:17 +01:00
Vincent Prouillet bfcfc1d341 Handle aud not being a sequence
Closes #110
2019-11-28 19:27:33 +01:00
Vincent Prouillet 51dacd9bc4 Update docs 2019-11-14 19:43:43 +01:00
Vincent Prouillet 8e4757cb1d More refactoring in the crypto mod 2019-11-11 20:29:57 +01:00
Vincent Prouillet 8169ee3d9f Remove chrono from deps 2019-11-11 19:47:35 +01:00
Vincent Prouillet 210e96063d Reorganise tests 2019-11-03 15:36:19 +00:00
Vincent Prouillet 06bebeaae3 cargo fmt 2019-11-03 12:55:36 +00:00
dowwie 60a030874a updated imports in validation.rs 2019-10-31 14:12:08 -04:00
dowwie 68d6c84c8c revised set_audience, cleaned up validation, and cleared compiler warnings 2019-10-28 11:49:02 -04:00
dowwie 0d7184a787 added update to aud type and aud validation 2019-10-27 15:14:52 -04:00
Vincent Prouillet b8627260b2 Update to edition 2018 2019-07-06 20:36:32 +02:00
Vincent Prouillet 84ee604e88 trait -> enum 2019-06-16 17:51:43 +02:00
Vincent Prouillet be27206088 Remove iat validation, it isnt supposed to be done 2019-02-04 18:44:08 +01:00
Frank Prößdorf 2793bc2be4 Fix documentation of default values in validation 2019-01-18 09:31:56 +02:00
Vincent Prouillet 8f0809318d rustfmt 2018-10-28 19:58:35 +01:00
Vincent Prouillet 5528497f5a Fix validation not working properly
Close #51
2018-07-25 15:42:02 +02:00
Vincent Prouillet 109978ab6b Remove error-chain
Fix #52, #56, #57
2018-07-25 14:46:30 +02:00
Vincent Prouillet eae3743017 Make it mandatory to specify algorithm 2017-10-22 13:23:46 +02:00
Vincent Prouillet 7e36d3f7bb Update ring and fix leeway docs 2017-08-30 18:09:57 +09:00
Vincent Prouillet d213fb8a62 Remove validate_signature option and add decode_header 2017-08-25 17:48:53 +09:00
Jacob Chang 8b4228cba1 Update dependencies (#33)
* Update ring to 0.11.0

* Update chrono to 0.4

* Bump to version 2.0.2
2017-06-24 15:15:45 +09:00
Clement RENAULT e5f518a860 doc: Correct markdown visual errors 2017-06-13 10:51:10 +02:00
Vincent Prouillet fc9f83b837 No need to pass an algorithm to decode 2017-04-22 15:21:44 +09:00
Vincent Prouillet 35fd9d63cc Add some docs 2017-04-13 10:08:07 +09:00
Vincent Prouillet 410499e6b6 Add validation 2017-04-12 17:51:05 +09:00