Skip to content

Commit

Permalink
chore(next): v4 module for development
Browse files Browse the repository at this point in the history
  • Loading branch information
muhlemmer committed Apr 2, 2024
1 parent 5cdb65c commit 14e8529
Show file tree
Hide file tree
Showing 98 changed files with 217 additions and 217 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)
[![Release](https://github.com/zitadel/oidc/workflows/Release/badge.svg)](https://github.com/zitadel/oidc/actions)
[![Go Reference](https://pkg.go.dev/badge/github.com/zitadel/oidc/v3.svg)](https://pkg.go.dev/github.com/zitadel/oidc/v3)
[![Go Reference](https://pkg.go.dev/badge/github.com/zitadel/oidc/v4.svg)](https://pkg.go.dev/github.com/zitadel/oidc/v4)
[![license](https://badgen.net/github/license/zitadel/oidc/)](https://github.com/zitadel/oidc/blob/master/LICENSE)
[![release](https://badgen.net/github/release/zitadel/oidc/stable)](https://github.com/zitadel/oidc/releases)
[![Go Report Card](https://goreportcard.com/badge/github.com/zitadel/oidc/v3)](https://goreportcard.com/report/github.com/zitadel/oidc/v3)
[![Go Report Card](https://goreportcard.com/badge/github.com/zitadel/oidc/v4)](https://goreportcard.com/report/github.com/zitadel/oidc/v4)
[![codecov](https://codecov.io/gh/zitadel/oidc/branch/main/graph/badge.svg)](https://codecov.io/gh/zitadel/oidc)

[![openid_certified](https://cloud.githubusercontent.com/assets/1454075/7611268/4d19de32-f97b-11e4-895b-31b2455a7ca6.png)](https://openid.net/certification/)
Expand Down Expand Up @@ -49,9 +49,9 @@ Check the `/example` folder where example code for different scenarios is locate
```bash
# start oidc op server
# oidc discovery http://localhost:9998/.well-known/openid-configuration
go run github.com/zitadel/oidc/v3/example/server
go run github.com/zitadel/oidc/v4/example/server
# start oidc web client (in a new terminal)
CLIENT_ID=web CLIENT_SECRET=secret ISSUER=http://localhost:9998/ SCOPES="openid profile" PORT=9999 go run github.com/zitadel/oidc/v3/example/client/app
CLIENT_ID=web CLIENT_SECRET=secret ISSUER=http://localhost:9998/ SCOPES="openid profile" PORT=9999 go run github.com/zitadel/oidc/v4/example/client/app
```

- open http://localhost:9999/login in your browser
Expand All @@ -61,11 +61,11 @@ CLIENT_ID=web CLIENT_SECRET=secret ISSUER=http://localhost:9998/ SCOPES="openid

for the dynamic issuer, just start it with:
```bash
go run github.com/zitadel/oidc/v3/example/server/dynamic
go run github.com/zitadel/oidc/v4/example/server/dynamic
```
the oidc web client above will still work, but if you add `oidc.local` (pointing to 127.0.0.1) in your hosts file you can also start it with:
```bash
CLIENT_ID=web CLIENT_SECRET=secret ISSUER=http://oidc.local:9998/ SCOPES="openid profile" PORT=9999 go run github.com/zitadel/oidc/v3/example/client/app
CLIENT_ID=web CLIENT_SECRET=secret ISSUER=http://oidc.local:9998/ SCOPES="openid profile" PORT=9999 go run github.com/zitadel/oidc/v4/example/client/app
```

> Note: Usernames are suffixed with the hostname (`test-user@localhost` or `test-user@oidc.local`)
Expand Down
4 changes: 2 additions & 2 deletions example/client/api/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ import (
"github.com/go-chi/chi/v5"
"github.com/sirupsen/logrus"

"github.com/zitadel/oidc/v3/pkg/client/rs"
"github.com/zitadel/oidc/v3/pkg/oidc"
"github.com/zitadel/oidc/v4/pkg/client/rs"
"github.com/zitadel/oidc/v4/pkg/oidc"
)

const (
Expand Down
6 changes: 3 additions & 3 deletions example/client/app/app.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import (
"github.com/sirupsen/logrus"

"github.com/zitadel/logging"
"github.com/zitadel/oidc/v3/pkg/client/rp"
httphelper "github.com/zitadel/oidc/v3/pkg/http"
"github.com/zitadel/oidc/v3/pkg/oidc"
"github.com/zitadel/oidc/v4/pkg/client/rp"
httphelper "github.com/zitadel/oidc/v4/pkg/http"
"github.com/zitadel/oidc/v4/pkg/oidc"
)

var (
Expand Down
4 changes: 2 additions & 2 deletions example/client/device/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@ import (

"github.com/sirupsen/logrus"

"github.com/zitadel/oidc/v3/pkg/client/rp"
httphelper "github.com/zitadel/oidc/v3/pkg/http"
"github.com/zitadel/oidc/v4/pkg/client/rp"
httphelper "github.com/zitadel/oidc/v4/pkg/http"
)

var (
Expand Down
8 changes: 4 additions & 4 deletions example/client/github/github.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import (
"golang.org/x/oauth2"
githubOAuth "golang.org/x/oauth2/github"

"github.com/zitadel/oidc/v3/pkg/client/rp"
"github.com/zitadel/oidc/v3/pkg/client/rp/cli"
"github.com/zitadel/oidc/v3/pkg/http"
"github.com/zitadel/oidc/v3/pkg/oidc"
"github.com/zitadel/oidc/v4/pkg/client/rp"
"github.com/zitadel/oidc/v4/pkg/client/rp/cli"
"github.com/zitadel/oidc/v4/pkg/http"
"github.com/zitadel/oidc/v4/pkg/oidc"
)

var (
Expand Down
2 changes: 1 addition & 1 deletion example/client/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import (
"github.com/sirupsen/logrus"
"golang.org/x/oauth2"

"github.com/zitadel/oidc/v3/pkg/client/profile"
"github.com/zitadel/oidc/v4/pkg/client/profile"
)

var client = http.DefaultClient
Expand Down
2 changes: 1 addition & 1 deletion example/server/dynamic/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

"github.com/go-chi/chi/v5"

"github.com/zitadel/oidc/v3/pkg/op"
"github.com/zitadel/oidc/v4/pkg/op"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions example/server/dynamic/op.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ import (
"github.com/go-chi/chi/v5"
"golang.org/x/text/language"

"github.com/zitadel/oidc/v3/example/server/storage"
"github.com/zitadel/oidc/v3/pkg/op"
"github.com/zitadel/oidc/v4/example/server/storage"
"github.com/zitadel/oidc/v4/pkg/op"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion example/server/exampleop/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import (
"github.com/go-chi/chi/v5"
"github.com/gorilla/securecookie"
"github.com/sirupsen/logrus"
"github.com/zitadel/oidc/v3/pkg/op"
"github.com/zitadel/oidc/v4/pkg/op"
)

type deviceAuthenticate interface {
Expand Down
2 changes: 1 addition & 1 deletion example/server/exampleop/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"net/http"

"github.com/go-chi/chi/v5"
"github.com/zitadel/oidc/v3/pkg/op"
"github.com/zitadel/oidc/v4/pkg/op"
)

type login struct {
Expand Down
4 changes: 2 additions & 2 deletions example/server/exampleop/op.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ import (
"github.com/zitadel/logging"
"golang.org/x/text/language"

"github.com/zitadel/oidc/v3/example/server/storage"
"github.com/zitadel/oidc/v3/pkg/op"
"github.com/zitadel/oidc/v4/example/server/storage"
"github.com/zitadel/oidc/v4/pkg/op"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions example/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (
"net/http"
"os"

"github.com/zitadel/oidc/v3/example/server/exampleop"
"github.com/zitadel/oidc/v3/example/server/storage"
"github.com/zitadel/oidc/v4/example/server/exampleop"
"github.com/zitadel/oidc/v4/example/server/storage"
)

func main() {
Expand Down
4 changes: 2 additions & 2 deletions example/server/storage/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ package storage
import (
"time"

"github.com/zitadel/oidc/v3/pkg/oidc"
"github.com/zitadel/oidc/v3/pkg/op"
"github.com/zitadel/oidc/v4/pkg/oidc"
"github.com/zitadel/oidc/v4/pkg/op"
)

var (
Expand Down
4 changes: 2 additions & 2 deletions example/server/storage/oidc.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (

"golang.org/x/text/language"

"github.com/zitadel/oidc/v3/pkg/oidc"
"github.com/zitadel/oidc/v3/pkg/op"
"github.com/zitadel/oidc/v4/pkg/oidc"
"github.com/zitadel/oidc/v4/pkg/op"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions example/server/storage/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ import (
jose "github.com/go-jose/go-jose/v3"
"github.com/google/uuid"

"github.com/zitadel/oidc/v3/pkg/oidc"
"github.com/zitadel/oidc/v3/pkg/op"
"github.com/zitadel/oidc/v4/pkg/oidc"
"github.com/zitadel/oidc/v4/pkg/op"
)

// serviceKey1 is a public key which will be used for the JWT Profile Authorization Grant
Expand Down
4 changes: 2 additions & 2 deletions example/server/storage/storage_dynamic.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (

jose "github.com/go-jose/go-jose/v3"

"github.com/zitadel/oidc/v3/pkg/oidc"
"github.com/zitadel/oidc/v3/pkg/op"
"github.com/zitadel/oidc/v4/pkg/oidc"
"github.com/zitadel/oidc/v4/pkg/op"
)

type multiStorage struct {
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module github.com/zitadel/oidc/v3
module github.com/zitadel/oidc/v4

go 1.21

Expand Down
4 changes: 2 additions & 2 deletions internal/testutil/gen/gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
"fmt"
"os"

tu "github.com/zitadel/oidc/v3/internal/testutil"
"github.com/zitadel/oidc/v3/pkg/oidc"
tu "github.com/zitadel/oidc/v4/internal/testutil"
"github.com/zitadel/oidc/v4/pkg/oidc"
)

var custom = map[string]any{
Expand Down
2 changes: 1 addition & 1 deletion internal/testutil/token.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

jose "github.com/go-jose/go-jose/v3"
"github.com/muhlemmer/gu"
"github.com/zitadel/oidc/v3/pkg/oidc"
"github.com/zitadel/oidc/v4/pkg/oidc"
)

// KeySet implements oidc.Keys
Expand Down
6 changes: 3 additions & 3 deletions pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@ import (

jose "github.com/go-jose/go-jose/v3"
"github.com/zitadel/logging"
"github.com/zitadel/oidc/v3/pkg/crypto"
httphelper "github.com/zitadel/oidc/v3/pkg/http"
"github.com/zitadel/oidc/v3/pkg/oidc"
"github.com/zitadel/oidc/v4/pkg/crypto"
httphelper "github.com/zitadel/oidc/v4/pkg/http"
"github.com/zitadel/oidc/v4/pkg/oidc"
"go.opentelemetry.io/otel"
"golang.org/x/oauth2"
)
Expand Down
16 changes: 8 additions & 8 deletions pkg/client/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,14 @@ import (
"github.com/stretchr/testify/require"
"golang.org/x/oauth2"

"github.com/zitadel/oidc/v3/example/server/exampleop"
"github.com/zitadel/oidc/v3/example/server/storage"
"github.com/zitadel/oidc/v3/pkg/client/rp"
"github.com/zitadel/oidc/v3/pkg/client/rs"
"github.com/zitadel/oidc/v3/pkg/client/tokenexchange"
httphelper "github.com/zitadel/oidc/v3/pkg/http"
"github.com/zitadel/oidc/v3/pkg/oidc"
"github.com/zitadel/oidc/v3/pkg/op"
"github.com/zitadel/oidc/v4/example/server/exampleop"
"github.com/zitadel/oidc/v4/example/server/storage"
"github.com/zitadel/oidc/v4/pkg/client/rp"
"github.com/zitadel/oidc/v4/pkg/client/rs"
"github.com/zitadel/oidc/v4/pkg/client/tokenexchange"
httphelper "github.com/zitadel/oidc/v4/pkg/http"
"github.com/zitadel/oidc/v4/pkg/oidc"
"github.com/zitadel/oidc/v4/pkg/op"
)

var Logger = slog.New(
Expand Down
4 changes: 2 additions & 2 deletions pkg/client/jwt_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (

"golang.org/x/oauth2"

"github.com/zitadel/oidc/v3/pkg/http"
"github.com/zitadel/oidc/v3/pkg/oidc"
"github.com/zitadel/oidc/v4/pkg/http"
"github.com/zitadel/oidc/v4/pkg/oidc"
)

// JWTProfileExchange handles the oauth2 jwt profile exchange
Expand Down
4 changes: 2 additions & 2 deletions pkg/client/profile/jwt_profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
jose "github.com/go-jose/go-jose/v3"
"golang.org/x/oauth2"

"github.com/zitadel/oidc/v3/pkg/client"
"github.com/zitadel/oidc/v3/pkg/oidc"
"github.com/zitadel/oidc/v4/pkg/client"
"github.com/zitadel/oidc/v4/pkg/oidc"
)

type TokenSource interface {
Expand Down
6 changes: 3 additions & 3 deletions pkg/client/rp/cli/cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import (
"context"
"net/http"

"github.com/zitadel/oidc/v3/pkg/client/rp"
httphelper "github.com/zitadel/oidc/v3/pkg/http"
"github.com/zitadel/oidc/v3/pkg/oidc"
"github.com/zitadel/oidc/v4/pkg/client/rp"
httphelper "github.com/zitadel/oidc/v4/pkg/http"
"github.com/zitadel/oidc/v4/pkg/oidc"
)

const (
Expand Down
2 changes: 1 addition & 1 deletion pkg/client/rp/delegation.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package rp

import (
"github.com/zitadel/oidc/v3/pkg/oidc/grants/tokenexchange"
"github.com/zitadel/oidc/v4/pkg/oidc/grants/tokenexchange"
)

// DelegationTokenRequest is an implementation of TokenExchangeRequest
Expand Down
4 changes: 2 additions & 2 deletions pkg/client/rp/device.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
"fmt"
"time"

"github.com/zitadel/oidc/v3/pkg/client"
"github.com/zitadel/oidc/v3/pkg/oidc"
"github.com/zitadel/oidc/v4/pkg/client"
"github.com/zitadel/oidc/v4/pkg/oidc"
)

func newDeviceClientCredentialsRequest(scopes []string, rp RelyingParty) (*oidc.ClientCredentialsRequest, error) {
Expand Down
6 changes: 3 additions & 3 deletions pkg/client/rp/jwks.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ import (

jose "github.com/go-jose/go-jose/v3"

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

func NewRemoteKeySet(client *http.Client, jwksURL string, opts ...func(*remoteKeySet)) oidc.KeySet {
Expand Down
6 changes: 3 additions & 3 deletions pkg/client/rp/relying_party.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ import (
"golang.org/x/oauth2/clientcredentials"

"github.com/zitadel/logging"
"github.com/zitadel/oidc/v3/pkg/client"
httphelper "github.com/zitadel/oidc/v3/pkg/http"
"github.com/zitadel/oidc/v3/pkg/oidc"
"github.com/zitadel/oidc/v4/pkg/client"
httphelper "github.com/zitadel/oidc/v4/pkg/http"
"github.com/zitadel/oidc/v4/pkg/oidc"
)

const (
Expand Down
4 changes: 2 additions & 2 deletions pkg/client/rp/relying_party_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import (

"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
tu "github.com/zitadel/oidc/v3/internal/testutil"
"github.com/zitadel/oidc/v3/pkg/oidc"
tu "github.com/zitadel/oidc/v4/internal/testutil"
"github.com/zitadel/oidc/v4/pkg/oidc"
"golang.org/x/oauth2"
)

Expand Down
2 changes: 1 addition & 1 deletion pkg/client/rp/tockenexchange.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (

"golang.org/x/oauth2"

"github.com/zitadel/oidc/v3/pkg/oidc/grants/tokenexchange"
"github.com/zitadel/oidc/v4/pkg/oidc/grants/tokenexchange"
)

// TokenExchangeRP extends the `RelyingParty` interface for the *draft* oauth2 `Token Exchange`
Expand Down
4 changes: 2 additions & 2 deletions pkg/client/rp/userinfo_example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import (
"context"
"fmt"

"github.com/zitadel/oidc/v3/pkg/client/rp"
"github.com/zitadel/oidc/v3/pkg/oidc"
"github.com/zitadel/oidc/v4/pkg/client/rp"
"github.com/zitadel/oidc/v4/pkg/oidc"
)

type UserInfo struct {
Expand Down
4 changes: 2 additions & 2 deletions pkg/client/rp/verifier.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import (

jose "github.com/go-jose/go-jose/v3"

"github.com/zitadel/oidc/v3/pkg/client"
"github.com/zitadel/oidc/v3/pkg/oidc"
"github.com/zitadel/oidc/v4/pkg/client"
"github.com/zitadel/oidc/v4/pkg/oidc"
)

// VerifyTokens implement the Token Response Validation as defined in OIDC specification
Expand Down
4 changes: 2 additions & 2 deletions pkg/client/rp/verifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
jose "github.com/go-jose/go-jose/v3"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
tu "github.com/zitadel/oidc/v3/internal/testutil"
"github.com/zitadel/oidc/v3/pkg/oidc"
tu "github.com/zitadel/oidc/v4/internal/testutil"
"github.com/zitadel/oidc/v4/pkg/oidc"
)

func TestVerifyTokens(t *testing.T) {
Expand Down
Loading

0 comments on commit 14e8529

Please sign in to comment.