Skip to content

Commit

Permalink
resolve some compatibility issues after merge
Browse files Browse the repository at this point in the history
  • Loading branch information
muhlemmer committed Feb 16, 2023
1 parent 8a8d9af commit ad5a422
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 13 deletions.
3 changes: 2 additions & 1 deletion pkg/client/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ func TestRelyingPartySession(t *testing.T) {
func TestResourceServerTokenExchange(t *testing.T) {
t.Log("------- start example OP ------")
ctx := context.Background()
exampleStorage := storage.NewStorage(storage.NewUserStore())
targetURL := "http://local-site"
exampleStorage := storage.NewStorage(storage.NewUserStore(targetURL))
var dh deferredHandler
opServer := httptest.NewServer(&dh)
defer opServer.Close()
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/rp/mock/generate.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package mock

//go:generate mockgen -package mock -destination ./verifier.mock.go github.com/zitadel/oidc/pkg/rp Verifier
//go:generate mockgen -package mock -destination ./verifier.mock.go github.com/zitadel/oidc/v2/pkg/rp Verifier
2 changes: 1 addition & 1 deletion pkg/client/rp/mock/verifier.mock.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions pkg/client/tokenexchange/tokenexchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"errors"
"net/http"

"github.com/zitadel/oidc/pkg/client"
httphelper "github.com/zitadel/oidc/pkg/http"
"github.com/zitadel/oidc/pkg/oidc"
"github.com/zitadel/oidc/v2/pkg/client"
httphelper "github.com/zitadel/oidc/v2/pkg/http"
"github.com/zitadel/oidc/v2/pkg/oidc"
)

type TokenExchanger interface {
Expand Down
10 changes: 5 additions & 5 deletions pkg/op/token_exchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (
"strings"
"time"

httphelper "github.com/zitadel/oidc/pkg/http"
"github.com/zitadel/oidc/pkg/oidc"
httphelper "github.com/zitadel/oidc/v2/pkg/http"
"github.com/zitadel/oidc/v2/pkg/oidc"
)

type TokenExchangeRequest interface {
Expand Down Expand Up @@ -291,7 +291,7 @@ func GetTokenIDAndSubjectFromToken(

tokenIDOrToken, subject, ok = token, refreshTokenRequest.GetSubject(), true
case oidc.IDTokenType:
idTokenClaims, err := VerifyIDTokenHint(ctx, token, exchanger.IDTokenHintVerifier())
idTokenClaims, err := VerifyIDTokenHint(ctx, token, exchanger.IDTokenHintVerifier(ctx))
if err != nil {
break
}
Expand Down Expand Up @@ -355,7 +355,7 @@ func CreateTokenExchangeResponse(

tokenType = oidc.BearerToken
case oidc.IDTokenType:
token, err = CreateIDToken(ctx, creator.Issuer(), tokenExchangeRequest, client.IDTokenLifetime(), "", "", creator.Storage(), creator.Signer(), client)
token, err = CreateIDToken(ctx, IssuerFromContext(ctx), tokenExchangeRequest, client.IDTokenLifetime(), "", "", creator.Storage(), client)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -390,7 +390,7 @@ func getTokenIDAndClaims(ctx context.Context, userinfoProvider UserinfoProvider,

return splitToken[0], splitToken[1], nil, true
}
accessTokenClaims, err := VerifyAccessToken(ctx, accessToken, userinfoProvider.AccessTokenVerifier())
accessTokenClaims, err := VerifyAccessToken(ctx, accessToken, userinfoProvider.AccessTokenVerifier(ctx))
if err != nil {
return "", "", nil, false
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/op/token_request.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@ type Exchanger interface {
GrantTypeTokenExchangeSupported() bool
GrantTypeJWTAuthorizationSupported() bool
GrantTypeClientCredentialsSupported() bool
AccessTokenVerifier() AccessTokenVerifier
IDTokenHintVerifier() IDTokenHintVerifier
AccessTokenVerifier(context.Context) AccessTokenVerifier
IDTokenHintVerifier(context.Context) IDTokenHintVerifier
}

func tokenHandler(exchanger Exchanger) func(w http.ResponseWriter, r *http.Request) {
Expand Down

0 comments on commit ad5a422

Please sign in to comment.