mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 03:27:32 +00:00
feat(api): add OIDC session service (#6157)
This PR starts the OIDC implementation for the API V2 including the Implicit and Code Flow. Co-authored-by: Livio Spring <livio.a@gmail.com> Co-authored-by: Tim Möhlmann <tim+github@zitadel.com> Co-authored-by: Stefan Benz <46600784+stebenz@users.noreply.github.com>
This commit is contained in:
@@ -4,6 +4,7 @@ import (
|
||||
"context"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"regexp"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@@ -18,9 +19,11 @@ import (
|
||||
"github.com/zitadel/zitadel/internal/eventstore"
|
||||
"github.com/zitadel/zitadel/internal/query/projection"
|
||||
"github.com/zitadel/zitadel/internal/repository/action"
|
||||
"github.com/zitadel/zitadel/internal/repository/authrequest"
|
||||
"github.com/zitadel/zitadel/internal/repository/idpintent"
|
||||
iam_repo "github.com/zitadel/zitadel/internal/repository/instance"
|
||||
"github.com/zitadel/zitadel/internal/repository/keypair"
|
||||
"github.com/zitadel/zitadel/internal/repository/oidcsession"
|
||||
"github.com/zitadel/zitadel/internal/repository/org"
|
||||
"github.com/zitadel/zitadel/internal/repository/project"
|
||||
"github.com/zitadel/zitadel/internal/repository/session"
|
||||
@@ -88,6 +91,8 @@ func StartQueries(
|
||||
usergrant.RegisterEventMappers(repo.eventstore)
|
||||
session.RegisterEventMappers(repo.eventstore)
|
||||
idpintent.RegisterEventMappers(repo.eventstore)
|
||||
authrequest.RegisterEventMappers(repo.eventstore)
|
||||
oidcsession.RegisterEventMappers(repo.eventstore)
|
||||
|
||||
repo.idpConfigEncryption = idpConfigEncryption
|
||||
repo.multifactors = domain.MultifactorConfigs{
|
||||
@@ -115,3 +120,19 @@ func (q *Queries) Health(ctx context.Context) error {
|
||||
type prepareDatabase interface {
|
||||
Timetravel(d time.Duration) string
|
||||
}
|
||||
|
||||
// cleanStaticQueries removes whitespaces,
|
||||
// such as ` `, \t, \n, from queries to improve
|
||||
// readability in logs and errors.
|
||||
func cleanStaticQueries(qs ...*string) {
|
||||
regex := regexp.MustCompile(`\s+`)
|
||||
for _, q := range qs {
|
||||
*q = regex.ReplaceAllString(*q, " ")
|
||||
}
|
||||
}
|
||||
|
||||
func init() {
|
||||
cleanStaticQueries(
|
||||
&authRequestByIDQuery,
|
||||
)
|
||||
}
|
||||
|
Reference in New Issue
Block a user