feat(oidc): use the new oidc server interface (#6779)

* feat(oidc): use the new oidc server interface

* rename from provider to server

* pin logging and oidc packages

* use oidc introspection fix branch

* add overloaded methods with tracing

* cleanup unused code

* include latest oidc fixes

---------

Co-authored-by: Livio Spring <livio.a@gmail.com>
This commit is contained in:
Tim Möhlmann
2023-10-25 18:44:05 +03:00
committed by GitHub
parent 4980cd6a0c
commit 94cf30c547
7 changed files with 233 additions and 86 deletions

View File

@@ -91,7 +91,7 @@ func (s *Server) failAuthRequest(ctx context.Context, authRequestID string, ae *
return nil, err
}
authReq := &oidc.AuthRequestV2{CurrentAuthRequest: aar}
callback, err := oidc.CreateErrorCallbackURL(authReq, errorReasonToOIDC(ae.GetError()), ae.GetErrorDescription(), ae.GetErrorUri(), s.op)
callback, err := oidc.CreateErrorCallbackURL(authReq, errorReasonToOIDC(ae.GetError()), ae.GetErrorDescription(), ae.GetErrorUri(), s.op.Provider())
if err != nil {
return nil, err
}
@@ -110,9 +110,9 @@ func (s *Server) linkSessionToAuthRequest(ctx context.Context, authRequestID str
ctx = op.ContextWithIssuer(ctx, http.BuildOrigin(authz.GetInstance(ctx).RequestedHost(), s.externalSecure))
var callback string
if aar.ResponseType == domain.OIDCResponseTypeCode {
callback, err = oidc.CreateCodeCallbackURL(ctx, authReq, s.op)
callback, err = oidc.CreateCodeCallbackURL(ctx, authReq, s.op.Provider())
} else {
callback, err = oidc.CreateTokenCallbackURL(ctx, authReq, s.op)
callback, err = oidc.CreateTokenCallbackURL(ctx, authReq, s.op.Provider())
}
if err != nil {
return nil, err

View File

@@ -1,11 +1,11 @@
package oidc
import (
"github.com/zitadel/oidc/v3/pkg/op"
"google.golang.org/grpc"
"github.com/zitadel/zitadel/internal/api/authz"
"github.com/zitadel/zitadel/internal/api/grpc/server"
"github.com/zitadel/zitadel/internal/api/oidc"
"github.com/zitadel/zitadel/internal/command"
"github.com/zitadel/zitadel/internal/query"
oidc_pb "github.com/zitadel/zitadel/pkg/grpc/oidc/v2beta"
@@ -18,7 +18,7 @@ type Server struct {
command *command.Commands
query *query.Queries
op op.OpenIDProvider
op *oidc.Server
externalSecure bool
}
@@ -27,7 +27,7 @@ type Config struct{}
func CreateServer(
command *command.Commands,
query *query.Queries,
op op.OpenIDProvider,
op *oidc.Server,
externalSecure bool,
) *Server {
return &Server{