Commit Graph

24 Commits

Author SHA1 Message Date
Craig Pastro c776b83291
Add error handling to examples (#312) 2023-10-09 21:31:36 +02:00
Ed Pelc c80de55abe
Add explicit ClaimsValidator implementation check for custom claims (#343)
* Add explicit ClaimsValidator implementation check for custom claims

Prevent user from misnaming or fat fingering the Validate() method implementation.

* Update example_test.go

---------

Co-authored-by: Christian Banse <oxisto@aybaze.com>
2023-09-13 15:34:54 +02:00
Oleksandr Redko 873d96d0a0
Refactor code by using switch instead of if-else (#318) 2023-07-18 08:44:48 +02:00
Oleksandr Redko b2b650971a
Reformat code: add whitespaces, remove empty lines (#319) 2023-06-21 12:39:55 +02:00
Michael Fridman 15f96b0627
Add golangci-lint (#279)
* Add golangci-lint-action

* Upgrading CodeQL to v2

* Fixed linting errors

---------

Co-authored-by: Christian Banse <oxisto@aybaze.com>
2023-03-31 13:20:59 +02:00
Christian Banse 1c4047f488
Adjusting the error checking example (#270)
This PR adjusts the error checking example so that a check for an invalid signature is also included.

See discussion in #143
2023-03-24 23:11:38 +01:00
Christian Banse 148d710109
`v5` Pre-Release (#234)
Co-authored-by: Micah Parks <66095735+MicahParks@users.noreply.github.com>
Co-authored-by: Michael Fridman <mf192@icloud.com>
2023-02-21 14:32:25 +01:00
Christian Banse 78a18c0808
Implementing `Is(err) bool` to support Go 1.13 style error checking (#136) 2022-01-19 22:55:19 +01:00
Christian Banse 80625fb516
Backwards-compatible implementation of RFC7519's registered claim's structure (#15)
This PR aims at implementing compliance to RFC7519, as documented in #11 without breaking the public API. It creates a new struct `RegisteredClaims` and deprecates (but not removes) the `StandardClaims`. It introduces a new type `NumericDate`, which represents a JSON numeric date value as specified in the RFC. This allows us to handle float as well as int-based time fields in `aud`, `exp` and `nbf`. Additionally, it introduces the type `StringArray`, which is basically a wrapper around `[]string` to deal with the oddities of the JWT `aud` field.
2021-08-22 19:23:13 +02:00
Michael Fridman 2ebb50f957
Adds go module support /v4 (#41)
Additionally, added `staticcheck` for basic static code analysis (#44)

Co-authored-by: Christian Banse <oxisto@aybaze.com>
2021-08-03 15:51:01 +02:00
Sadman Sakib 6a07921e68
Enable go module support for the project (#3)
* initial go module file

Signed-off-by: sadmansakib <ssadman8@gmail.com>

* fix linting issues

Signed-off-by: sadmansakib <ssadman8@gmail.com>

* rename module to golang-jwt/jwt

Signed-off-by: sadmansakib <ssadman8@gmail.com>

* Renamed imports to match with go module name.

Signed-off-by: sadmansakib <ssadman8@gmail.com>

* update travis for latest go versions

Signed-off-by: sadmansakib <ssadman8@gmail.com>

* Set go version to 1.14

lowered the go version to make it consistent with matrix build

* revert accidental changes while renaming

Signed-off-by: sadmansakib <ssadman8@gmail.com>

* remove travis CI

no longer needed since github actions workflow was created for the
project

Signed-off-by: sadmansakib <ssadman8@gmail.com>

* Revert "remove travis CI"

This reverts commit b3ae57f710.

* update travis for older go versions
2021-05-28 21:26:41 -04:00
Dave Grijalva 5e270fa6cd changed argument order to put claims type before keyfunc. this is easier to read when keyfunc is an inline closure 2016-04-12 16:25:25 -07:00
Dave Grijalva 0c245a4f7e added example of parsing using custom type 2016-04-12 13:33:20 -07:00
Dave Grijalva c466333a1b expanded usefulness and correctness of examples 2016-04-12 13:18:31 -07:00
Dave Grijalva 9c00ec7ce7 more/simpler examples 2015-08-18 13:28:52 -07:00
Dave Grijalva e0b58f1724 MapClaim -> MapClaims 2015-08-18 10:18:57 -07:00
Dave Grijalva a1fc9b87e6 fixed ordering of map output in example test 2015-08-18 09:45:50 -07:00
Jamie Stackhouse ddfa84b397 Changed test to explicitly show that you can change the map without type
asserting every call.
2015-07-22 13:53:37 -03:00
Jamie Stackhouse 6f536a0d2d Changed example to use Output test. 2015-07-22 13:48:42 -03:00
Jamie Stackhouse b00e282378 Update README with some migration information. 2015-07-20 13:20:18 -03:00
Jamie Stackhouse a33fdf927a Going through and updating tests to pass.
Still need to add a test that utilizes the defaults of the structured
object.

Update Cmdline app

Update package reference for PR.

Update examples
2015-07-17 15:14:04 -03:00
Dave Grijalva fb5e9d4418 updated ExampleNew with correct key type 2015-01-13 21:31:08 -08:00
Dave Grijalva d9679c1420 added some examples of unpacking errors from the bitfield 2014-12-28 12:44:46 -08:00
Dave Grijalva db4251f9dd added examples 2014-12-28 12:24:54 -08:00