Skip to content
Merged
Show file tree
Hide file tree
Changes from 13 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 0 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2
with:
path: src/github.com/golang-jwt/jwt
- name: Setup Go
uses: actions/setup-go@v2
with:
Expand All @@ -28,6 +26,3 @@ jobs:
go vet ./...
go test -v ./...
go build ./...
env:
GO111MODULE: auto
GOPATH: ${{ github.workspace }}
22 changes: 11 additions & 11 deletions MIGRATION_GUIDE.md
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
## Migration Guide (v3.2.1)
## Migration Guide (v4.0.0)

Starting from [v3.2.1](https://github.com/golang-jwt/jwt/releases/tag/v3.2.1]), the import path has changed from `github.com/dgrijalva/jwt-go` to `github.com/golang-jwt/jwt`. Future releases will be using the `github.com/golang-jwt/jwt` import path and continue the existing versioning scheme of `v3.x.x+incompatible`. Backwards-compatible patches and fixes will be done on the `v3` release branch, where as new build-breaking features will be developed in a `v4` release, possibly including a SIV-style import path.
Starting from [v4.0.0](https://github.com/golang-jwt/jwt/releases/tag/v4.0.0]), the import path will be:

### go.mod replacement
"github.com/golang-jwt/jwt/v4"

In a first step, the easiest way is to use `go mod edit` to issue a replacement.
The `/v4` version will be backwards compatible with existing `v3.x.y` tags in this repo, as well as
`github.com/dgrijalva/jwt-go`. For most users this should be a drop-in replacement, if you're having
troubles migrating, please open an issue.

You can replace all occurrences of `github.com/dgrijalva/jwt-go` or `github.com/golang-jwt/jwt` with `github.com/golang-jwt/jwt/v4`, either manually or by using tools such as `sed` or `gofmt`.

And then you'd typically run:

```
go mod edit -replace github.com/dgrijalva/jwt-go=github.com/golang-jwt/jwt@v3.2.1+incompatible
go get github.com/golang-jwt/jwt/v4
go mod tidy
```

This will still keep the old import path in your code but replace it with the new package and also introduce a new indirect dependency to `github.com/golang-jwt/jwt`. Try to compile your project; it should still work.

### Cleanup

If your code still consistently builds, you can replace all occurences of `github.com/dgrijalva/jwt-go` with `github.com/golang-jwt/jwt`, either manually or by using tools such as `sed`. Finally, the `replace` directive in the `go.mod` file can be removed.

## Older releases (before v3.2.0)

The original migration guide for older releases can be found at https://github.com/dgrijalva/jwt-go/blob/master/MIGRATION_GUIDE.md.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@

A [go](http://www.golang.org) (or 'golang' for search engine friendliness) implementation of [JSON Web Tokens](https://datatracker.ietf.org/doc/html/rfc7519).

**IMPORT PATH CHANGE:** Starting from [v3.2.1](https://github.com/golang-jwt/jwt/releases/tag/v3.2.1), the import path has changed from `github.com/dgrijalva/jwt-go` to `github.com/golang-jwt/jwt`. After the original author of the library suggested migrating the maintenance of `jwt-go`, a dedicated team of open source maintainers decided to clone the existing library into this repository. See [dgrijalva/jwt-go#462](https://github.com/dgrijalva/jwt-go/issues/462) for a detailed discussion on this topic.
Starting with [v4.0.0](https://github.com/golang-jwt/jwt/releases/tag/v4.0.0) this project adds Go module support, but maintains backwards compataibility with older `v3.x.y` tags and upstream `github.com/dgrijalva/jwt-go`.
See the `MIGRATION_GUIDE.md` for more information.

> After the original author of the library suggested migrating the maintenance of `jwt-go`, a dedicated team of open source maintainers decided to clone the existing library into this repository. See [dgrijalva/jwt-go#462](https://github.com/dgrijalva/jwt-go/issues/462) for a detailed discussion on this topic.

Future releases will be using the `github.com/golang-jwt/jwt` import path and continue the existing versioning scheme of `v3.x.x+incompatible`. Backwards-compatible patches and fixes will be done on the `v3` release branch, where as new build-breaking features will be developed in a `v4` release, possibly including a SIV-style import path.

**SECURITY NOTICE:** Some older versions of Go have a security issue in the crypto/elliptic. Recommendation is to upgrade to at least 1.15 See issue [dgrijalva/jwt-go#216](https://github.com/dgrijalva/jwt-go/issues/216) for more detail.

Expand Down Expand Up @@ -60,10 +62,8 @@ This library is considered production ready. Feedback and feature requests are

This project uses [Semantic Versioning 2.0.0](http://semver.org). Accepted pull requests will land on `main`. Periodically, versions will be tagged from `main`. You can find all the releases on [the project releases page](https://github.com/golang-jwt/jwt/releases).

While we try to make it obvious when we make breaking changes, there isn't a great mechanism for pushing announcements out to users. You may want to use this alternative package include: `gopkg.in/golang-jwt/jwt.v3`. It will do the right thing WRT semantic versioning.

**BREAKING CHANGES:***
* Version 3.0.0 includes _a lot_ of changes from the 2.x line, including a few that break the API. We've tried to break as few things as possible, so there should just be a few type signature changes. A full list of breaking changes is available in `VERSION_HISTORY.md`. See `MIGRATION_GUIDE.md` for more information on updating your code.
A full list of breaking changes is available in `VERSION_HISTORY.md`. See `MIGRATION_GUIDE.md` for more information on updating your code.

## Usage Tips

Expand Down
4 changes: 4 additions & 0 deletions VERSION_HISTORY.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## `jwt-go` Version History

#### 4.0.0

* Introduces support for Go modules. The `v4` version will be backwards compatible with `v3.x.y`.

#### 3.2.2

* Starting from this release, we are adopting the policy to support the most 2 recent versions of Go currently available. By the time of this release, this is Go 1.15 and 1.16 ([#28](https://github.com/golang-jwt/jwt/pull/28)).
Expand Down
3 changes: 1 addition & 2 deletions cmd/jwt/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,4 @@ To simply display a token, use:

You can install this tool with the following command:

go install github.com/golang-jwt/jwt/cmd/jwt

go install github.com/golang-jwt/jwt/v4/cmd/jwt
23 changes: 0 additions & 23 deletions cmd/jwt/args.go

This file was deleted.

18 changes: 17 additions & 1 deletion cmd/jwt/app.go → cmd/jwt/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import (
"regexp"
"strings"

"github.com/golang-jwt/jwt"
"github.com/golang-jwt/jwt/v4"
)

var (
Expand Down Expand Up @@ -295,3 +295,19 @@ func isRs() bool {
func isEd() bool {
return strings.HasPrefix(strings.ToUpper(*flagAlg), "Ed")
}

type ArgList map[string]string

func (l ArgList) String() string {
data, _ := json.Marshal(l)
return string(data)
}

func (l ArgList) Set(arg string) error {
parts := strings.SplitN(arg, "=", 2)
if len(parts) != 2 {
return fmt.Errorf("Invalid argument '%v'. Must use format 'key=value'. %v", arg, parts)
}
l[parts[0]] = parts[1]
return nil
}
2 changes: 1 addition & 1 deletion ecdsa_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"strings"
"testing"

"github.com/golang-jwt/jwt"
"github.com/golang-jwt/jwt/v4"
)

var ecdsaTestData = []struct {
Expand Down
2 changes: 1 addition & 1 deletion ed25519_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strings"
"testing"

"github.com/golang-jwt/jwt"
"github.com/golang-jwt/jwt/v4"
)

var ed25519TestData = []struct {
Expand Down
2 changes: 1 addition & 1 deletion example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"fmt"
"time"

"github.com/golang-jwt/jwt"
"github.com/golang-jwt/jwt/v4"
)

// Example (atypical) using the StandardClaims type by itself to parse a token.
Expand Down
3 changes: 3 additions & 0 deletions go.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module github.com/golang-jwt/jwt/v4

go 1.15
Empty file added go.sum
Empty file.
2 changes: 1 addition & 1 deletion hmac_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"io/ioutil"
"time"

"github.com/golang-jwt/jwt"
"github.com/golang-jwt/jwt/v4"
)

// For HMAC signing method, the key can be any []byte. It is recommended to generate
Expand Down
2 changes: 1 addition & 1 deletion hmac_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strings"
"testing"

"github.com/golang-jwt/jwt"
"github.com/golang-jwt/jwt/v4"
)

var hmacTestData = []struct {
Expand Down
4 changes: 2 additions & 2 deletions http_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ import (
"strings"
"time"

"github.com/golang-jwt/jwt"
"github.com/golang-jwt/jwt/request"
"github.com/golang-jwt/jwt/v4"
"github.com/golang-jwt/jwt/v4/request"
)

// location of the files used for signing and verification
Expand Down
2 changes: 1 addition & 1 deletion none_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"strings"
"testing"

"github.com/golang-jwt/jwt"
"github.com/golang-jwt/jwt/v4"
)

var noneTestData = []struct {
Expand Down
4 changes: 2 additions & 2 deletions parser_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"testing"
"time"

"github.com/golang-jwt/jwt"
"github.com/golang-jwt/jwt/test"
"github.com/golang-jwt/jwt/v4"
"github.com/golang-jwt/jwt/v4/test"
)

var keyFuncError error = fmt.Errorf("error loading key")
Expand Down
2 changes: 1 addition & 1 deletion request/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package request
import (
"net/http"

"github.com/golang-jwt/jwt"
"github.com/golang-jwt/jwt/v4"
)

// Extract and parse a JWT token from an HTTP request.
Expand Down
4 changes: 2 additions & 2 deletions request/request_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"strings"
"testing"

"github.com/golang-jwt/jwt"
"github.com/golang-jwt/jwt/test"
"github.com/golang-jwt/jwt/v4"
"github.com/golang-jwt/jwt/v4/test"
)

var requestTestData = []struct {
Expand Down
4 changes: 2 additions & 2 deletions rsa_pss_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import (
"testing"
"time"

"github.com/golang-jwt/jwt"
"github.com/golang-jwt/jwt/test"
"github.com/golang-jwt/jwt/v4"
"github.com/golang-jwt/jwt/v4/test"
)

var rsaPSSTestData = []struct {
Expand Down
2 changes: 1 addition & 1 deletion rsa_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"strings"
"testing"

"github.com/golang-jwt/jwt"
"github.com/golang-jwt/jwt/v4"
)

var rsaTestData = []struct {
Expand Down
2 changes: 1 addition & 1 deletion test/helpers.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"crypto/rsa"
"io/ioutil"

"github.com/golang-jwt/jwt"
"github.com/golang-jwt/jwt/v4"
)

func LoadRSAPrivateKeyFromDisk(location string) *rsa.PrivateKey {
Expand Down