Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: use github.com/go-jose/go-jose/v3 over deprecated square package #240

Merged
merged 1 commit into from
Jan 23, 2024
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion app/data/private/key.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"crypto/rsa"
"encoding/base64"

"github.com/go-jose/go-jose/v3"
"github.com/pkg/errors"
"gopkg.in/square/go-jose.v2"
)

type Key struct {
Expand Down
2 changes: 1 addition & 1 deletion app/services/session_refresher_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"net/url"
"testing"

"github.com/go-jose/go-jose/v3/jwt"
"github.com/keratin/authn-server/app"
"github.com/keratin/authn-server/app/data/mock"
"github.com/keratin/authn-server/app/data/private"
Expand All @@ -15,7 +16,6 @@ import (
"github.com/sirupsen/logrus"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gopkg.in/square/go-jose.v2/jwt"
)

func TestSessionRefresher(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions app/tokens/identities/identity.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ import (

"github.com/keratin/authn-server/app/data/private"

"github.com/go-jose/go-jose/v3"
"github.com/go-jose/go-jose/v3/jwt"
"github.com/keratin/authn-server/app"
"github.com/keratin/authn-server/app/tokens/sessions"
"github.com/pkg/errors"
"gopkg.in/square/go-jose.v2"
"gopkg.in/square/go-jose.v2/jwt"
)

// CLaims represent the JWT claims known to authn.
Expand Down
2 changes: 1 addition & 1 deletion app/tokens/identities/identity_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (

"github.com/keratin/authn-server/app/data/private"

"gopkg.in/square/go-jose.v2"
"github.com/go-jose/go-jose/v3"

"github.com/keratin/authn-server/app"
"github.com/keratin/authn-server/app/data/mock"
Expand Down
4 changes: 2 additions & 2 deletions app/tokens/oauth/oauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@ import (
"fmt"
"time"

jose "github.com/go-jose/go-jose/v3"
jwt "github.com/go-jose/go-jose/v3/jwt"
"github.com/keratin/authn-server/app"
"github.com/pkg/errors"
jose "gopkg.in/square/go-jose.v2"
jwt "gopkg.in/square/go-jose.v2/jwt"
)

const scope = "oauth"
Expand Down
2 changes: 1 addition & 1 deletion app/tokens/oauth/oauth_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import (
"net/url"
"testing"

"github.com/go-jose/go-jose/v3"
"github.com/keratin/authn-server/app"
"github.com/keratin/authn-server/app/tokens/oauth"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"gopkg.in/square/go-jose.v2"
)

func TestOAuthToken(t *testing.T) {
Expand Down
4 changes: 2 additions & 2 deletions app/tokens/passwordless/passwordless_token.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ import (
"strconv"
"time"

jose "github.com/go-jose/go-jose/v3"
jwt "github.com/go-jose/go-jose/v3/jwt"
"github.com/keratin/authn-server/app"
"github.com/pkg/errors"
jose "gopkg.in/square/go-jose.v2"
jwt "gopkg.in/square/go-jose.v2/jwt"
)

const scope = "passwordless"
Expand Down
6 changes: 3 additions & 3 deletions app/tokens/resets/password_reset.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@ import (
"strconv"
"time"

jose "github.com/go-jose/go-jose/v3"
jwt "github.com/go-jose/go-jose/v3/jwt"
"github.com/keratin/authn-server/app"
"github.com/pkg/errors"
jose "gopkg.in/square/go-jose.v2"
jwt "gopkg.in/square/go-jose.v2/jwt"
)

const scope = "reset"

type Claims struct {
Scope string `json:"scope"`
Scope string `json:"scope"`
Lock *jwt.NumericDate `json:"lock"`
jwt.Claims
}
Expand Down
2 changes: 1 addition & 1 deletion app/tokens/resets/password_reset_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"testing"
"time"

jwt "gopkg.in/square/go-jose.v2/jwt"
jwt "github.com/go-jose/go-jose/v3/jwt"

"github.com/keratin/authn-server/app"
"github.com/keratin/authn-server/app/tokens/resets"
Expand Down
4 changes: 2 additions & 2 deletions app/tokens/sessions/session.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import (
"fmt"
"time"

jose "github.com/go-jose/go-jose/v3"
jwt "github.com/go-jose/go-jose/v3/jwt"
"github.com/google/uuid"
"github.com/keratin/authn-server/app"
"github.com/keratin/authn-server/app/data"
"github.com/pkg/errors"
jose "gopkg.in/square/go-jose.v2"
jwt "gopkg.in/square/go-jose.v2/jwt"
)

const scope = "refresh"
Expand Down
2 changes: 1 addition & 1 deletion app/tokens/sessions/session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"net/url"
"testing"

jwt "gopkg.in/square/go-jose.v2/jwt"
jwt "github.com/go-jose/go-jose/v3/jwt"

"github.com/keratin/authn-server/app"
"github.com/keratin/authn-server/app/data/mock"
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ require (
github.com/dlclark/regexp2 v1.1.6 // indirect
github.com/felixge/httpsnoop v1.0.0
github.com/getsentry/sentry-go v0.3.0
github.com/go-jose/go-jose/v3 v3.0.1
github.com/go-redis/redis/v8 v8.11.5
github.com/go-sql-driver/mysql v1.3.0
github.com/google/uuid v1.3.0
Expand All @@ -23,10 +24,9 @@ require (
github.com/pquerna/otp v1.2.0
github.com/prometheus/client_golang v1.11.1
github.com/sirupsen/logrus v1.6.0
github.com/stretchr/testify v1.5.1
github.com/stretchr/testify v1.6.1
github.com/test-go/testify v1.1.4
github.com/trustelem/zxcvbn v1.0.1
golang.org/x/crypto v0.17.0
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421
gopkg.in/square/go-jose.v2 v2.3.1
)
11 changes: 8 additions & 3 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ github.com/gin-gonic/gin v1.4.0/go.mod h1:OW2EZn3DO8Ln9oIKOvM++LBO+5UPHJJDH72/q/
github.com/go-check/check v0.0.0-20180628173108-788fd7840127/go.mod h1:9ES+weclKsC9YodN5RgxqK/VD9HM9JsCSh7rNhMZE98=
github.com/go-errors/errors v1.0.1 h1:LUHzmkK3GUKUrL/1gfBUxAHzcev3apQlezX/+O7ma6w=
github.com/go-errors/errors v1.0.1/go.mod h1:f4zRHt4oKfwPJE5k8C9vpYG+aDHdBFUsgrm6/TyX73Q=
github.com/go-jose/go-jose/v3 v3.0.1 h1:pWmKFVtt+Jl0vBZTIpz/eAKwsm6LkIxDVVbFHKkchhA=
github.com/go-jose/go-jose/v3 v3.0.1/go.mod h1:RNkWWRld676jZEYoV3+XK8L2ZnNSvIsxFMht0mSX+u8=
github.com/go-kit/kit v0.8.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/kit v0.9.0/go.mod h1:xBxKIO96dXMWWy0MnWVtmwkA9/13aqxPnvrjFYMA2as=
github.com/go-kit/log v0.1.0/go.mod h1:zbhenjAZHb184qTLMA9ZjW7ThYL0H2mk7Q6pNt4vbaY=
Expand Down Expand Up @@ -82,6 +84,7 @@ github.com/golang/protobuf v1.5.2/go.mod h1:XVQd3VNwM+JqD3oG2Ue2ip4fOMUkwXdXDdiu
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.4/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
github.com/google/go-cmp v0.5.5 h1:Khx7svrCpmxxtHBq5j2mp/xVjsi8hQMfNLvJFAlrGgU=
github.com/google/go-cmp v0.5.5/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
Expand Down Expand Up @@ -215,8 +218,9 @@ github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4=
github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA=
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
github.com/test-go/testify v1.1.4 h1:Tf9lntrKUMHiXQ07qBScBTSA0dhYQlu83hswqelv1iE=
github.com/test-go/testify v1.1.4/go.mod h1:rH7cfJo/47vWGdi4GPj16x3/t1xGOj2YxzmNQzk2ghU=
github.com/trustelem/zxcvbn v1.0.1 h1:mp4JFtzdDYGj9WYSD3KQSkwwUumWNFzXaAjckaTYpsc=
Expand All @@ -239,6 +243,7 @@ github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5t
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190701094942-4def268fd1a4/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20190911031432-227b76d455e7/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
Expand Down Expand Up @@ -354,8 +359,6 @@ gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMy
gopkg.in/go-playground/assert.v1 v1.2.1/go.mod h1:9RXL0bg/zibRAgZUYszZSwO/z8Y/a8bDuhia5mkpMnE=
gopkg.in/go-playground/validator.v8 v8.18.2/go.mod h1:RX2a/7Ha8BgOhfk7j780h4/u/RRjR0eouCJSH80/M2Y=
gopkg.in/mgo.v2 v2.0.0-20180705113604-9856a29383ce/go.mod h1:yeKp02qBN3iKW1OzL3MGk2IdtZzaj7SFntXj72NppTA=
gopkg.in/square/go-jose.v2 v2.3.1 h1:SK5KegNXmKmqE342YYN2qPHEnUYeoMiXXl1poUlI+o4=
gopkg.in/square/go-jose.v2 v2.3.1/go.mod h1:M9dMgbHiYLoDGQrXy7OpJDJWiKiU//h+vD76mk0e1AI=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 h1:uRGJdciOHaEIrze2W8Q3AKkepLTh2hOroT7a+7czfdQ=
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
Expand All @@ -365,3 +368,5 @@ gopkg.in/yaml.v2 v2.2.5/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
2 changes: 1 addition & 1 deletion lib/oauth/discord.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"encoding/json"
"io"

"github.com/go-jose/go-jose/v3"
"golang.org/x/oauth2"
"gopkg.in/square/go-jose.v2"
)

// NewDiscordProvider returns a AuthN integration for Discord OAuth
Expand Down
2 changes: 1 addition & 1 deletion lib/oauth/facebook.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"encoding/json"
"io"

"github.com/go-jose/go-jose/v3"
"golang.org/x/oauth2"
"golang.org/x/oauth2/facebook"
"gopkg.in/square/go-jose.v2"
)

// NewFacebookProvider returns a AuthN integration for Facebook OAuth
Expand Down
2 changes: 1 addition & 1 deletion lib/oauth/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ import (
"io"
"strconv"

"github.com/go-jose/go-jose/v3"
"golang.org/x/oauth2"
"golang.org/x/oauth2/github"
"gopkg.in/square/go-jose.v2"
)

// NewGitHubProvider returns a AuthN integration for GitHub OAuth
Expand Down
2 changes: 1 addition & 1 deletion lib/oauth/google.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"encoding/json"
"io"

"github.com/go-jose/go-jose/v3"
"golang.org/x/oauth2"
"golang.org/x/oauth2/google"
"gopkg.in/square/go-jose.v2"
)

// NewGoogleProvider returns a AuthN integration for Google OAuth
Expand Down
2 changes: 1 addition & 1 deletion lib/oauth/microsoft.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"fmt"
"io"

"github.com/go-jose/go-jose/v3"
"golang.org/x/oauth2"
"gopkg.in/square/go-jose.v2"
)

// NewMicrosoftProvider returns a AuthN integration for Microsoft OAuth
Expand Down
2 changes: 1 addition & 1 deletion lib/oauth/provider.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package oauth

import (
"github.com/go-jose/go-jose/v3"
"golang.org/x/oauth2"
"gopkg.in/square/go-jose.v2"
)

// Provider is a struct wrapping the necessary bits to integrate an OAuth2 provider with AuthN
Expand Down
2 changes: 1 addition & 1 deletion lib/oauth/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package oauth
import (
"net/http/httptest"

"github.com/go-jose/go-jose/v3"
"golang.org/x/oauth2"
"gopkg.in/square/go-jose.v2"
)

// NewTestProvider returns a special Provider for tests
Expand Down
2 changes: 1 addition & 1 deletion server/handlers/get_jwks.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package handlers
import (
"net/http"

"github.com/go-jose/go-jose/v3"
"github.com/keratin/authn-server/app"
"gopkg.in/square/go-jose.v2"
)

func GetJWKs(app *app.App) http.HandlerFunc {
Expand Down
2 changes: 1 addition & 1 deletion server/handlers/get_oauth_return_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"net/http/httptest"
"testing"

"github.com/go-jose/go-jose/v3"
"github.com/stretchr/testify/assert"
"gopkg.in/square/go-jose.v2"

"github.com/stretchr/testify/require"

Expand Down
2 changes: 1 addition & 1 deletion server/test/asserts.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import (
"reflect"
"testing"

jwt "gopkg.in/square/go-jose.v2/jwt"
jwt "github.com/go-jose/go-jose/v3/jwt"

"github.com/keratin/authn-server/app"
"github.com/keratin/authn-server/app/data"
Expand Down
4 changes: 2 additions & 2 deletions server/test/sessions.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ package test
import (
"net/http"

jose "github.com/go-jose/go-jose/v3"
jwt "github.com/go-jose/go-jose/v3/jwt"
"github.com/keratin/authn-server/app"
"github.com/keratin/authn-server/app/data"
"github.com/keratin/authn-server/app/models"
"github.com/keratin/authn-server/app/tokens/sessions"
jose "gopkg.in/square/go-jose.v2"
jwt "gopkg.in/square/go-jose.v2/jwt"
)

func CreateSession(tokenStore data.RefreshTokenStore, cfg *app.Config, accountID int) *http.Cookie {
Expand Down