Skip to content

Commit

Permalink
feat: Define redirect uris with env variables (#644)
Browse files Browse the repository at this point in the history
Co-authored-by: Andrey Rusakov <andrey.rusakov@camptocamp.com>
  • Loading branch information
lanseg and Andrey Rusakov authored Sep 3, 2024
1 parent 5e464b4 commit e1633bd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 9 deletions.
9 changes: 0 additions & 9 deletions example/server/exampleop/op.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,13 @@ 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"
)

const (
pathLoggedOut = "/logged-out"
)

func init() {
storage.RegisterClients(
storage.NativeClient("native"),
storage.WebClient("web", "secret"),
storage.WebClient("api", "secret"),
)
}

type Storage interface {
op.Storage
authenticate
Expand Down
7 changes: 7 additions & 0 deletions example/server/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"log/slog"
"net/http"
"os"
"strings"

"github.com/zitadel/oidc/v3/example/server/exampleop"
"github.com/zitadel/oidc/v3/example/server/storage"
Expand All @@ -16,6 +17,12 @@ func main() {
//which gives us the issuer: http://localhost:9998/
issuer := fmt.Sprintf("http://localhost:%s/", port)

storage.RegisterClients(
storage.NativeClient("native", strings.Split(os.Getenv("REDIRECT_URI"), ",")...),
storage.WebClient("web", "secret"),
storage.WebClient("api", "secret"),
)

// the OpenIDProvider interface needs a Storage interface handling various checks and state manipulations
// this might be the layer for accessing your database
// in this example it will be handled in-memory
Expand Down

0 comments on commit e1633bd

Please sign in to comment.