mirror of
https://github.com/zitadel/zitadel.git
synced 2025-05-11 01:36:48 +00:00
drop owner_removed column on apps and authN tables
This commit is contained in:
parent
96a53aa130
commit
c0c86d90c9
@ -630,7 +630,7 @@ func (s *Server) getUsers(ctx context.Context, org string, withPasswords bool, w
|
|||||||
return nil, nil, nil, nil, err
|
return nil, nil, nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
keys, err := s.query.SearchAuthNKeysData(ctx, &query.AuthNKeySearchQueries{Queries: []query.SearchQuery{userIDQuery, orgIDQuery}}, false)
|
keys, err := s.query.SearchAuthNKeysData(ctx, &query.AuthNKeySearchQueries{Queries: []query.SearchQuery{userIDQuery, orgIDQuery}})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, nil, nil, err
|
return nil, nil, nil, nil, err
|
||||||
}
|
}
|
||||||
@ -836,7 +836,7 @@ func (s *Server) getProjectsAndApps(ctx context.Context, org string) ([]*v1_pb.D
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, nil, nil, nil, err
|
return nil, nil, nil, nil, nil, err
|
||||||
}
|
}
|
||||||
keys, err := s.query.SearchAuthNKeysData(ctx, &query.AuthNKeySearchQueries{Queries: []query.SearchQuery{appIDQuery, projectIDQuery, orgIDQuery}}, false)
|
keys, err := s.query.SearchAuthNKeysData(ctx, &query.AuthNKeySearchQueries{Queries: []query.SearchQuery{appIDQuery, projectIDQuery, orgIDQuery}})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, nil, nil, nil, err
|
return nil, nil, nil, nil, nil, err
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (s *Server) GetAppByID(ctx context.Context, req *mgmt_pb.GetAppByIDRequest) (*mgmt_pb.GetAppByIDResponse, error) {
|
func (s *Server) GetAppByID(ctx context.Context, req *mgmt_pb.GetAppByIDRequest) (*mgmt_pb.GetAppByIDResponse, error) {
|
||||||
app, err := s.query.AppByProjectAndAppID(ctx, true, req.ProjectId, req.AppId, false)
|
app, err := s.query.AppByProjectAndAppID(ctx, true, req.ProjectId, req.AppId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -259,7 +259,7 @@ func (s *Server) GetAppKey(ctx context.Context, req *mgmt_pb.GetAppKeyRequest) (
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
key, err := s.query.GetAuthNKeyByID(ctx, true, req.KeyId, false, resourceOwner, aggregateID, objectID)
|
key, err := s.query.GetAuthNKeyByID(ctx, true, req.KeyId, resourceOwner, aggregateID, objectID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -753,7 +753,7 @@ func (s *Server) GetMachineKeyByIDs(ctx context.Context, req *mgmt_pb.GetMachine
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
key, err := s.query.GetAuthNKeyByID(ctx, true, req.KeyId, false, resourceOwner, aggregateID)
|
key, err := s.query.GetAuthNKeyByID(ctx, true, req.KeyId, resourceOwner, aggregateID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -102,7 +102,7 @@ func (o *OPStorage) audienceFromProjectID(ctx context.Context, projectID string)
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
appIDs, err := o.query.SearchClientIDs(ctx, &query.AppSearchQueries{Queries: []query.SearchQuery{projectIDQuery}}, false)
|
appIDs, err := o.query.SearchClientIDs(ctx, &query.AppSearchQueries{Queries: []query.SearchQuery{projectIDQuery}})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -432,7 +432,7 @@ func (o *OPStorage) assertProjectRoleScopes(ctx context.Context, clientID string
|
|||||||
return scopes, nil
|
return scopes, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
projectID, err := o.query.ProjectIDFromOIDCClientID(ctx, clientID, false)
|
projectID, err := o.query.ProjectIDFromOIDCClientID(ctx, clientID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.ThrowPreconditionFailed(nil, "OIDC-AEG4d", "Errors.Internal")
|
return nil, errors.ThrowPreconditionFailed(nil, "OIDC-AEG4d", "Errors.Internal")
|
||||||
}
|
}
|
||||||
|
@ -44,7 +44,7 @@ const (
|
|||||||
func (o *OPStorage) GetClientByClientID(ctx context.Context, id string) (_ op.Client, err error) {
|
func (o *OPStorage) GetClientByClientID(ctx context.Context, id string) (_ op.Client, err error) {
|
||||||
ctx, span := tracing.NewSpan(ctx)
|
ctx, span := tracing.NewSpan(ctx)
|
||||||
defer func() { span.EndWithError(err) }()
|
defer func() { span.EndWithError(err) }()
|
||||||
client, err := o.query.AppByOIDCClientID(ctx, id, false)
|
client, err := o.query.AppByOIDCClientID(ctx, id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -109,7 +109,7 @@ func (o *OPStorage) AuthorizeClientIDSecret(ctx context.Context, id string, secr
|
|||||||
UserID: oidcCtx,
|
UserID: oidcCtx,
|
||||||
OrgID: oidcCtx,
|
OrgID: oidcCtx,
|
||||||
})
|
})
|
||||||
app, err := o.query.AppByClientID(ctx, id, false)
|
app, err := o.query.AppByClientID(ctx, id)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -150,7 +150,7 @@ func (o *OPStorage) SetUserinfoFromScopes(ctx context.Context, userInfo *oidc.Us
|
|||||||
ctx, span := tracing.NewSpan(ctx)
|
ctx, span := tracing.NewSpan(ctx)
|
||||||
defer func() { span.EndWithError(err) }()
|
defer func() { span.EndWithError(err) }()
|
||||||
if applicationID != "" {
|
if applicationID != "" {
|
||||||
app, err := o.query.AppByOIDCClientID(ctx, applicationID, false)
|
app, err := o.query.AppByOIDCClientID(ctx, applicationID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -184,7 +184,7 @@ func (o *OPStorage) SetIntrospectionFromToken(ctx context.Context, introspection
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.ThrowPermissionDenied(nil, "OIDC-Dsfb2", "token is not valid or has expired")
|
return errors.ThrowPermissionDenied(nil, "OIDC-Dsfb2", "token is not valid or has expired")
|
||||||
}
|
}
|
||||||
projectID, err := o.query.ProjectIDFromClientID(ctx, clientID, false)
|
projectID, err := o.query.ProjectIDFromClientID(ctx, clientID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errors.ThrowPermissionDenied(nil, "OIDC-Adfg5", "client not found")
|
return errors.ThrowPermissionDenied(nil, "OIDC-Adfg5", "client not found")
|
||||||
}
|
}
|
||||||
@ -245,7 +245,7 @@ func (o *OPStorage) isOriginAllowed(ctx context.Context, clientID, origin string
|
|||||||
if origin == "" {
|
if origin == "" {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
app, err := o.query.AppByOIDCClientID(ctx, clientID, false)
|
app, err := o.query.AppByOIDCClientID(ctx, clientID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -750,7 +750,7 @@ func (o *OPStorage) assertRoles(ctx context.Context, userID, applicationID strin
|
|||||||
if (applicationID == "" || len(requestedRoles) == 0) && len(roleAudience) == 0 {
|
if (applicationID == "" || len(requestedRoles) == 0) && len(roleAudience) == 0 {
|
||||||
return nil, nil, nil
|
return nil, nil, nil
|
||||||
}
|
}
|
||||||
projectID, err := o.query.ProjectIDFromClientID(ctx, applicationID, false)
|
projectID, err := o.query.ProjectIDFromClientID(ctx, applicationID)
|
||||||
// applicationID might contain a username (e.g. client credentials) -> ignore the not found
|
// applicationID might contain a username (e.g. client credentials) -> ignore the not found
|
||||||
if err != nil && !errors.IsNotFound(err) {
|
if err != nil && !errors.IsNotFound(err) {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
|
@ -55,7 +55,7 @@ type Storage struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *Storage) GetEntityByID(ctx context.Context, entityID string) (*serviceprovider.ServiceProvider, error) {
|
func (p *Storage) GetEntityByID(ctx context.Context, entityID string) (*serviceprovider.ServiceProvider, error) {
|
||||||
app, err := p.query.AppBySAMLEntityID(ctx, entityID, false)
|
app, err := p.query.AppBySAMLEntityID(ctx, entityID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -72,7 +72,7 @@ func (p *Storage) GetEntityByID(ctx context.Context, entityID string) (*servicep
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *Storage) GetEntityIDByAppID(ctx context.Context, appID string) (string, error) {
|
func (p *Storage) GetEntityIDByAppID(ctx context.Context, appID string) (string, error) {
|
||||||
app, err := p.query.AppByID(ctx, appID, false)
|
app, err := p.query.AppByID(ctx, appID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", err
|
return "", err
|
||||||
}
|
}
|
||||||
@ -314,7 +314,7 @@ func (p *Storage) getCustomAttributes(ctx context.Context, user *query.User, use
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *Storage) getGrants(ctx context.Context, userID, applicationID string) (*query.UserGrants, error) {
|
func (p *Storage) getGrants(ctx context.Context, userID, applicationID string) (*query.UserGrants, error) {
|
||||||
projectID, err := p.query.ProjectIDFromClientID(ctx, applicationID, false)
|
projectID, err := p.query.ProjectIDFromClientID(ctx, applicationID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -113,7 +113,7 @@ type projectProvider interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type applicationProvider interface {
|
type applicationProvider interface {
|
||||||
AppByOIDCClientID(context.Context, string, bool) (*query.App, error)
|
AppByOIDCClientID(context.Context, string) (*query.App, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type customTextProvider interface {
|
type customTextProvider interface {
|
||||||
@ -140,7 +140,7 @@ func (repo *AuthRequestRepo) CreateAuthRequest(ctx context.Context, request *dom
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
appIDs, err := repo.Query.SearchClientIDs(ctx, &query.AppSearchQueries{Queries: []query.SearchQuery{projectIDQuery}}, false)
|
appIDs, err := repo.Query.SearchClientIDs(ctx, &query.AppSearchQueries{Queries: []query.SearchQuery{projectIDQuery}})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -1351,7 +1351,7 @@ func (repo *AuthRequestRepo) hasSucceededPage(ctx context.Context, request *doma
|
|||||||
if _, ok := request.Request.(*domain.AuthRequestOIDC); !ok {
|
if _, ok := request.Request.(*domain.AuthRequestOIDC); !ok {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
app, err := provider.AppByOIDCClientID(ctx, request.ApplicationID, false)
|
app, err := provider.AppByOIDCClientID(ctx, request.ApplicationID)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
@ -272,7 +272,7 @@ type mockApp struct {
|
|||||||
app *query.App
|
app *query.App
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *mockApp) AppByOIDCClientID(ctx context.Context, id string, _ bool) (*query.App, error) {
|
func (m *mockApp) AppByOIDCClientID(ctx context.Context, id string) (*query.App, error) {
|
||||||
if m.app != nil {
|
if m.app != nil {
|
||||||
return m.app, nil
|
return m.app, nil
|
||||||
}
|
}
|
||||||
|
@ -9,7 +9,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func (v *View) ApplicationByOIDCClientID(ctx context.Context, clientID string) (*query.App, error) {
|
func (v *View) ApplicationByOIDCClientID(ctx context.Context, clientID string) (*query.App, error) {
|
||||||
return v.Query.AppByOIDCClientID(ctx, clientID, false)
|
return v.Query.AppByOIDCClientID(ctx, clientID)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (v *View) ApplicationByProjecIDAndAppName(ctx context.Context, projectID, appName string) (_ *query.App, err error) {
|
func (v *View) ApplicationByProjecIDAndAppName(ctx context.Context, projectID, appName string) (_ *query.App, err error) {
|
||||||
|
@ -126,10 +126,6 @@ var (
|
|||||||
name: projection.AppColumnSequence,
|
name: projection.AppColumnSequence,
|
||||||
table: appsTable,
|
table: appsTable,
|
||||||
}
|
}
|
||||||
AppColumnOwnerRemoved = Column{
|
|
||||||
name: projection.AppColumnOwnerRemoved,
|
|
||||||
table: appsTable,
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@ -249,7 +245,7 @@ var (
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
func (q *Queries) AppByProjectAndAppID(ctx context.Context, shouldTriggerBulk bool, projectID, appID string, withOwnerRemoved bool) (app *App, err error) {
|
func (q *Queries) AppByProjectAndAppID(ctx context.Context, shouldTriggerBulk bool, projectID, appID string) (app *App, err error) {
|
||||||
ctx, span := tracing.NewSpan(ctx)
|
ctx, span := tracing.NewSpan(ctx)
|
||||||
defer func() { span.EndWithError(err) }()
|
defer func() { span.EndWithError(err) }()
|
||||||
|
|
||||||
@ -266,9 +262,6 @@ func (q *Queries) AppByProjectAndAppID(ctx context.Context, shouldTriggerBulk bo
|
|||||||
AppColumnProjectID.identifier(): projectID,
|
AppColumnProjectID.identifier(): projectID,
|
||||||
AppColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID(),
|
AppColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID(),
|
||||||
}
|
}
|
||||||
if !withOwnerRemoved {
|
|
||||||
eq[AppColumnOwnerRemoved.identifier()] = false
|
|
||||||
}
|
|
||||||
query, args, err := stmt.Where(eq).ToSql()
|
query, args, err := stmt.Where(eq).ToSql()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.ThrowInternal(err, "QUERY-AFDgg", "Errors.Query.SQLStatement")
|
return nil, errors.ThrowInternal(err, "QUERY-AFDgg", "Errors.Query.SQLStatement")
|
||||||
@ -281,7 +274,7 @@ func (q *Queries) AppByProjectAndAppID(ctx context.Context, shouldTriggerBulk bo
|
|||||||
return app, err
|
return app, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (q *Queries) AppByID(ctx context.Context, appID string, withOwnerRemoved bool) (app *App, err error) {
|
func (q *Queries) AppByID(ctx context.Context, appID string) (app *App, err error) {
|
||||||
ctx, span := tracing.NewSpan(ctx)
|
ctx, span := tracing.NewSpan(ctx)
|
||||||
defer func() { span.EndWithError(err) }()
|
defer func() { span.EndWithError(err) }()
|
||||||
|
|
||||||
@ -290,9 +283,6 @@ func (q *Queries) AppByID(ctx context.Context, appID string, withOwnerRemoved bo
|
|||||||
AppColumnID.identifier(): appID,
|
AppColumnID.identifier(): appID,
|
||||||
AppColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID(),
|
AppColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID(),
|
||||||
}
|
}
|
||||||
if !withOwnerRemoved {
|
|
||||||
eq[AppColumnOwnerRemoved.identifier()] = false
|
|
||||||
}
|
|
||||||
query, args, err := stmt.Where(eq).ToSql()
|
query, args, err := stmt.Where(eq).ToSql()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.ThrowInternal(err, "QUERY-immt9", "Errors.Query.SQLStatement")
|
return nil, errors.ThrowInternal(err, "QUERY-immt9", "Errors.Query.SQLStatement")
|
||||||
@ -305,7 +295,7 @@ func (q *Queries) AppByID(ctx context.Context, appID string, withOwnerRemoved bo
|
|||||||
return app, err
|
return app, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (q *Queries) AppBySAMLEntityID(ctx context.Context, entityID string, withOwnerRemoved bool) (app *App, err error) {
|
func (q *Queries) AppBySAMLEntityID(ctx context.Context, entityID string) (app *App, err error) {
|
||||||
ctx, span := tracing.NewSpan(ctx)
|
ctx, span := tracing.NewSpan(ctx)
|
||||||
defer func() { span.EndWithError(err) }()
|
defer func() { span.EndWithError(err) }()
|
||||||
|
|
||||||
@ -314,9 +304,6 @@ func (q *Queries) AppBySAMLEntityID(ctx context.Context, entityID string, withOw
|
|||||||
AppSAMLConfigColumnEntityID.identifier(): entityID,
|
AppSAMLConfigColumnEntityID.identifier(): entityID,
|
||||||
AppColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID(),
|
AppColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID(),
|
||||||
}
|
}
|
||||||
if !withOwnerRemoved {
|
|
||||||
eq[AppColumnOwnerRemoved.identifier()] = false
|
|
||||||
}
|
|
||||||
query, args, err := stmt.Where(eq).ToSql()
|
query, args, err := stmt.Where(eq).ToSql()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.ThrowInternal(err, "QUERY-JgUop", "Errors.Query.SQLStatement")
|
return nil, errors.ThrowInternal(err, "QUERY-JgUop", "Errors.Query.SQLStatement")
|
||||||
@ -357,7 +344,7 @@ func (q *Queries) ProjectByClientID(ctx context.Context, appID string, withOwner
|
|||||||
return project, err
|
return project, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (q *Queries) ProjectIDFromOIDCClientID(ctx context.Context, appID string, withOwnerRemoved bool) (id string, err error) {
|
func (q *Queries) ProjectIDFromOIDCClientID(ctx context.Context, appID string) (id string, err error) {
|
||||||
ctx, span := tracing.NewSpan(ctx)
|
ctx, span := tracing.NewSpan(ctx)
|
||||||
defer func() { span.EndWithError(err) }()
|
defer func() { span.EndWithError(err) }()
|
||||||
|
|
||||||
@ -366,9 +353,6 @@ func (q *Queries) ProjectIDFromOIDCClientID(ctx context.Context, appID string, w
|
|||||||
AppOIDCConfigColumnClientID.identifier(): appID,
|
AppOIDCConfigColumnClientID.identifier(): appID,
|
||||||
AppColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID(),
|
AppColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID(),
|
||||||
}
|
}
|
||||||
if !withOwnerRemoved {
|
|
||||||
eq[AppColumnOwnerRemoved.identifier()] = false
|
|
||||||
}
|
|
||||||
query, args, err := stmt.Where(eq).ToSql()
|
query, args, err := stmt.Where(eq).ToSql()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return "", errors.ThrowInternal(err, "QUERY-7d92U", "Errors.Query.SQLStatement")
|
return "", errors.ThrowInternal(err, "QUERY-7d92U", "Errors.Query.SQLStatement")
|
||||||
@ -381,15 +365,12 @@ func (q *Queries) ProjectIDFromOIDCClientID(ctx context.Context, appID string, w
|
|||||||
return id, err
|
return id, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (q *Queries) ProjectIDFromClientID(ctx context.Context, appID string, withOwnerRemoved bool) (id string, err error) {
|
func (q *Queries) ProjectIDFromClientID(ctx context.Context, appID string) (id string, err error) {
|
||||||
ctx, span := tracing.NewSpan(ctx)
|
ctx, span := tracing.NewSpan(ctx)
|
||||||
defer func() { span.EndWithError(err) }()
|
defer func() { span.EndWithError(err) }()
|
||||||
|
|
||||||
stmt, scan := prepareProjectIDByAppQuery(ctx, q.client)
|
stmt, scan := prepareProjectIDByAppQuery(ctx, q.client)
|
||||||
eq := sq.Eq{AppColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID()}
|
eq := sq.Eq{AppColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID()}
|
||||||
if !withOwnerRemoved {
|
|
||||||
eq[AppColumnOwnerRemoved.identifier()] = false
|
|
||||||
}
|
|
||||||
where := sq.And{
|
where := sq.And{
|
||||||
eq,
|
eq,
|
||||||
sq.Or{
|
sq.Or{
|
||||||
@ -410,7 +391,7 @@ func (q *Queries) ProjectIDFromClientID(ctx context.Context, appID string, withO
|
|||||||
return id, err
|
return id, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (q *Queries) ProjectByOIDCClientID(ctx context.Context, id string, withOwnerRemoved bool) (project *Project, err error) {
|
func (q *Queries) ProjectByOIDCClientID(ctx context.Context, id string) (project *Project, err error) {
|
||||||
ctx, span := tracing.NewSpan(ctx)
|
ctx, span := tracing.NewSpan(ctx)
|
||||||
defer func() { span.EndWithError(err) }()
|
defer func() { span.EndWithError(err) }()
|
||||||
|
|
||||||
@ -419,9 +400,6 @@ func (q *Queries) ProjectByOIDCClientID(ctx context.Context, id string, withOwne
|
|||||||
AppOIDCConfigColumnClientID.identifier(): id,
|
AppOIDCConfigColumnClientID.identifier(): id,
|
||||||
AppColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID(),
|
AppColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID(),
|
||||||
}
|
}
|
||||||
if !withOwnerRemoved {
|
|
||||||
eq[AppColumnOwnerRemoved.identifier()] = false
|
|
||||||
}
|
|
||||||
query, args, err := stmt.Where(eq).ToSql()
|
query, args, err := stmt.Where(eq).ToSql()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.ThrowInternal(err, "QUERY-XhJi4", "Errors.Query.SQLStatement")
|
return nil, errors.ThrowInternal(err, "QUERY-XhJi4", "Errors.Query.SQLStatement")
|
||||||
@ -434,7 +412,7 @@ func (q *Queries) ProjectByOIDCClientID(ctx context.Context, id string, withOwne
|
|||||||
return project, err
|
return project, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (q *Queries) AppByOIDCClientID(ctx context.Context, clientID string, withOwnerRemoved bool) (app *App, err error) {
|
func (q *Queries) AppByOIDCClientID(ctx context.Context, clientID string) (app *App, err error) {
|
||||||
ctx, span := tracing.NewSpan(ctx)
|
ctx, span := tracing.NewSpan(ctx)
|
||||||
defer func() { span.EndWithError(err) }()
|
defer func() { span.EndWithError(err) }()
|
||||||
|
|
||||||
@ -443,9 +421,6 @@ func (q *Queries) AppByOIDCClientID(ctx context.Context, clientID string, withOw
|
|||||||
AppOIDCConfigColumnClientID.identifier(): clientID,
|
AppOIDCConfigColumnClientID.identifier(): clientID,
|
||||||
AppColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID(),
|
AppColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID(),
|
||||||
}
|
}
|
||||||
if !withOwnerRemoved {
|
|
||||||
eq[AppColumnOwnerRemoved.identifier()] = false
|
|
||||||
}
|
|
||||||
query, args, err := stmt.Where(eq).ToSql()
|
query, args, err := stmt.Where(eq).ToSql()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.ThrowInternal(err, "QUERY-JgVop", "Errors.Query.SQLStatement")
|
return nil, errors.ThrowInternal(err, "QUERY-JgVop", "Errors.Query.SQLStatement")
|
||||||
@ -458,15 +433,12 @@ func (q *Queries) AppByOIDCClientID(ctx context.Context, clientID string, withOw
|
|||||||
return app, err
|
return app, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (q *Queries) AppByClientID(ctx context.Context, clientID string, withOwnerRemoved bool) (app *App, err error) {
|
func (q *Queries) AppByClientID(ctx context.Context, clientID string) (app *App, err error) {
|
||||||
ctx, span := tracing.NewSpan(ctx)
|
ctx, span := tracing.NewSpan(ctx)
|
||||||
defer func() { span.EndWithError(err) }()
|
defer func() { span.EndWithError(err) }()
|
||||||
|
|
||||||
stmt, scan := prepareAppQuery(ctx, q.client)
|
stmt, scan := prepareAppQuery(ctx, q.client)
|
||||||
eq := sq.Eq{AppColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID()}
|
eq := sq.Eq{AppColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID()}
|
||||||
if !withOwnerRemoved {
|
|
||||||
eq[AppColumnOwnerRemoved.identifier()] = false
|
|
||||||
}
|
|
||||||
query, args, err := stmt.Where(sq.And{
|
query, args, err := stmt.Where(sq.And{
|
||||||
eq,
|
eq,
|
||||||
sq.Or{
|
sq.Or{
|
||||||
@ -491,9 +463,6 @@ func (q *Queries) SearchApps(ctx context.Context, queries *AppSearchQueries, wit
|
|||||||
|
|
||||||
query, scan := prepareAppsQuery(ctx, q.client)
|
query, scan := prepareAppsQuery(ctx, q.client)
|
||||||
eq := sq.Eq{AppColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID()}
|
eq := sq.Eq{AppColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID()}
|
||||||
if !withOwnerRemoved {
|
|
||||||
eq[AppColumnOwnerRemoved.identifier()] = false
|
|
||||||
}
|
|
||||||
stmt, args, err := queries.toQuery(query).Where(eq).ToSql()
|
stmt, args, err := queries.toQuery(query).Where(eq).ToSql()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.ThrowInvalidArgument(err, "QUERY-fajp8", "Errors.Query.InvalidRequest")
|
return nil, errors.ThrowInvalidArgument(err, "QUERY-fajp8", "Errors.Query.InvalidRequest")
|
||||||
@ -510,15 +479,12 @@ func (q *Queries) SearchApps(ctx context.Context, queries *AppSearchQueries, wit
|
|||||||
return apps, err
|
return apps, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (q *Queries) SearchClientIDs(ctx context.Context, queries *AppSearchQueries, withOwnerRemoved bool) (ids []string, err error) {
|
func (q *Queries) SearchClientIDs(ctx context.Context, queries *AppSearchQueries) (ids []string, err error) {
|
||||||
ctx, span := tracing.NewSpan(ctx)
|
ctx, span := tracing.NewSpan(ctx)
|
||||||
defer func() { span.EndWithError(err) }()
|
defer func() { span.EndWithError(err) }()
|
||||||
|
|
||||||
query, scan := prepareClientIDsQuery(ctx, q.client)
|
query, scan := prepareClientIDsQuery(ctx, q.client)
|
||||||
eq := sq.Eq{AppColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID()}
|
eq := sq.Eq{AppColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID()}
|
||||||
if !withOwnerRemoved {
|
|
||||||
eq[AppColumnOwnerRemoved.identifier()] = false
|
|
||||||
}
|
|
||||||
stmt, args, err := queries.toQuery(query).Where(eq).ToSql()
|
stmt, args, err := queries.toQuery(query).Where(eq).ToSql()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.ThrowInvalidArgument(err, "QUERY-fajp8", "Errors.Query.InvalidRequest")
|
return nil, errors.ThrowInvalidArgument(err, "QUERY-fajp8", "Errors.Query.InvalidRequest")
|
||||||
|
@ -15,98 +15,98 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
expectedAppQuery = regexp.QuoteMeta(`SELECT projections.apps5.id,` +
|
expectedAppQuery = regexp.QuoteMeta(`SELECT projections.apps6.id,` +
|
||||||
` projections.apps5.name,` +
|
` projections.apps6.name,` +
|
||||||
` projections.apps5.project_id,` +
|
` projections.apps6.project_id,` +
|
||||||
` projections.apps5.creation_date,` +
|
` projections.apps6.creation_date,` +
|
||||||
` projections.apps5.change_date,` +
|
` projections.apps6.change_date,` +
|
||||||
` projections.apps5.resource_owner,` +
|
` projections.apps6.resource_owner,` +
|
||||||
` projections.apps5.state,` +
|
` projections.apps6.state,` +
|
||||||
` projections.apps5.sequence,` +
|
` projections.apps6.sequence,` +
|
||||||
// api config
|
// api config
|
||||||
` projections.apps5_api_configs.app_id,` +
|
` projections.apps6_api_configs.app_id,` +
|
||||||
` projections.apps5_api_configs.client_id,` +
|
` projections.apps6_api_configs.client_id,` +
|
||||||
` projections.apps5_api_configs.auth_method,` +
|
` projections.apps6_api_configs.auth_method,` +
|
||||||
// oidc config
|
// oidc config
|
||||||
` projections.apps5_oidc_configs.app_id,` +
|
` projections.apps6_oidc_configs.app_id,` +
|
||||||
` projections.apps5_oidc_configs.version,` +
|
` projections.apps6_oidc_configs.version,` +
|
||||||
` projections.apps5_oidc_configs.client_id,` +
|
` projections.apps6_oidc_configs.client_id,` +
|
||||||
` projections.apps5_oidc_configs.redirect_uris,` +
|
` projections.apps6_oidc_configs.redirect_uris,` +
|
||||||
` projections.apps5_oidc_configs.response_types,` +
|
` projections.apps6_oidc_configs.response_types,` +
|
||||||
` projections.apps5_oidc_configs.grant_types,` +
|
` projections.apps6_oidc_configs.grant_types,` +
|
||||||
` projections.apps5_oidc_configs.application_type,` +
|
` projections.apps6_oidc_configs.application_type,` +
|
||||||
` projections.apps5_oidc_configs.auth_method_type,` +
|
` projections.apps6_oidc_configs.auth_method_type,` +
|
||||||
` projections.apps5_oidc_configs.post_logout_redirect_uris,` +
|
` projections.apps6_oidc_configs.post_logout_redirect_uris,` +
|
||||||
` projections.apps5_oidc_configs.is_dev_mode,` +
|
` projections.apps6_oidc_configs.is_dev_mode,` +
|
||||||
` projections.apps5_oidc_configs.access_token_type,` +
|
` projections.apps6_oidc_configs.access_token_type,` +
|
||||||
` projections.apps5_oidc_configs.access_token_role_assertion,` +
|
` projections.apps6_oidc_configs.access_token_role_assertion,` +
|
||||||
` projections.apps5_oidc_configs.id_token_role_assertion,` +
|
` projections.apps6_oidc_configs.id_token_role_assertion,` +
|
||||||
` projections.apps5_oidc_configs.id_token_userinfo_assertion,` +
|
` projections.apps6_oidc_configs.id_token_userinfo_assertion,` +
|
||||||
` projections.apps5_oidc_configs.clock_skew,` +
|
` projections.apps6_oidc_configs.clock_skew,` +
|
||||||
` projections.apps5_oidc_configs.additional_origins,` +
|
` projections.apps6_oidc_configs.additional_origins,` +
|
||||||
` projections.apps5_oidc_configs.skip_native_app_success_page,` +
|
` projections.apps6_oidc_configs.skip_native_app_success_page,` +
|
||||||
//saml config
|
//saml config
|
||||||
` projections.apps5_saml_configs.app_id,` +
|
` projections.apps6_saml_configs.app_id,` +
|
||||||
` projections.apps5_saml_configs.entity_id,` +
|
` projections.apps6_saml_configs.entity_id,` +
|
||||||
` projections.apps5_saml_configs.metadata,` +
|
` projections.apps6_saml_configs.metadata,` +
|
||||||
` projections.apps5_saml_configs.metadata_url` +
|
` projections.apps6_saml_configs.metadata_url` +
|
||||||
` FROM projections.apps5` +
|
` FROM projections.apps6` +
|
||||||
` LEFT JOIN projections.apps5_api_configs ON projections.apps5.id = projections.apps5_api_configs.app_id AND projections.apps5.instance_id = projections.apps5_api_configs.instance_id` +
|
` LEFT JOIN projections.apps6_api_configs ON projections.apps6.id = projections.apps6_api_configs.app_id AND projections.apps6.instance_id = projections.apps6_api_configs.instance_id` +
|
||||||
` LEFT JOIN projections.apps5_oidc_configs ON projections.apps5.id = projections.apps5_oidc_configs.app_id AND projections.apps5.instance_id = projections.apps5_oidc_configs.instance_id` +
|
` LEFT JOIN projections.apps6_oidc_configs ON projections.apps6.id = projections.apps6_oidc_configs.app_id AND projections.apps6.instance_id = projections.apps6_oidc_configs.instance_id` +
|
||||||
` LEFT JOIN projections.apps5_saml_configs ON projections.apps5.id = projections.apps5_saml_configs.app_id AND projections.apps5.instance_id = projections.apps5_saml_configs.instance_id` +
|
` LEFT JOIN projections.apps6_saml_configs ON projections.apps6.id = projections.apps6_saml_configs.app_id AND projections.apps6.instance_id = projections.apps6_saml_configs.instance_id` +
|
||||||
` AS OF SYSTEM TIME '-1 ms'`)
|
` AS OF SYSTEM TIME '-1 ms'`)
|
||||||
expectedAppsQuery = regexp.QuoteMeta(`SELECT projections.apps5.id,` +
|
expectedAppsQuery = regexp.QuoteMeta(`SELECT projections.apps6.id,` +
|
||||||
` projections.apps5.name,` +
|
` projections.apps6.name,` +
|
||||||
` projections.apps5.project_id,` +
|
` projections.apps6.project_id,` +
|
||||||
` projections.apps5.creation_date,` +
|
` projections.apps6.creation_date,` +
|
||||||
` projections.apps5.change_date,` +
|
` projections.apps6.change_date,` +
|
||||||
` projections.apps5.resource_owner,` +
|
` projections.apps6.resource_owner,` +
|
||||||
` projections.apps5.state,` +
|
` projections.apps6.state,` +
|
||||||
` projections.apps5.sequence,` +
|
` projections.apps6.sequence,` +
|
||||||
// api config
|
// api config
|
||||||
` projections.apps5_api_configs.app_id,` +
|
` projections.apps6_api_configs.app_id,` +
|
||||||
` projections.apps5_api_configs.client_id,` +
|
` projections.apps6_api_configs.client_id,` +
|
||||||
` projections.apps5_api_configs.auth_method,` +
|
` projections.apps6_api_configs.auth_method,` +
|
||||||
// oidc config
|
// oidc config
|
||||||
` projections.apps5_oidc_configs.app_id,` +
|
` projections.apps6_oidc_configs.app_id,` +
|
||||||
` projections.apps5_oidc_configs.version,` +
|
` projections.apps6_oidc_configs.version,` +
|
||||||
` projections.apps5_oidc_configs.client_id,` +
|
` projections.apps6_oidc_configs.client_id,` +
|
||||||
` projections.apps5_oidc_configs.redirect_uris,` +
|
` projections.apps6_oidc_configs.redirect_uris,` +
|
||||||
` projections.apps5_oidc_configs.response_types,` +
|
` projections.apps6_oidc_configs.response_types,` +
|
||||||
` projections.apps5_oidc_configs.grant_types,` +
|
` projections.apps6_oidc_configs.grant_types,` +
|
||||||
` projections.apps5_oidc_configs.application_type,` +
|
` projections.apps6_oidc_configs.application_type,` +
|
||||||
` projections.apps5_oidc_configs.auth_method_type,` +
|
` projections.apps6_oidc_configs.auth_method_type,` +
|
||||||
` projections.apps5_oidc_configs.post_logout_redirect_uris,` +
|
` projections.apps6_oidc_configs.post_logout_redirect_uris,` +
|
||||||
` projections.apps5_oidc_configs.is_dev_mode,` +
|
` projections.apps6_oidc_configs.is_dev_mode,` +
|
||||||
` projections.apps5_oidc_configs.access_token_type,` +
|
` projections.apps6_oidc_configs.access_token_type,` +
|
||||||
` projections.apps5_oidc_configs.access_token_role_assertion,` +
|
` projections.apps6_oidc_configs.access_token_role_assertion,` +
|
||||||
` projections.apps5_oidc_configs.id_token_role_assertion,` +
|
` projections.apps6_oidc_configs.id_token_role_assertion,` +
|
||||||
` projections.apps5_oidc_configs.id_token_userinfo_assertion,` +
|
` projections.apps6_oidc_configs.id_token_userinfo_assertion,` +
|
||||||
` projections.apps5_oidc_configs.clock_skew,` +
|
` projections.apps6_oidc_configs.clock_skew,` +
|
||||||
` projections.apps5_oidc_configs.additional_origins,` +
|
` projections.apps6_oidc_configs.additional_origins,` +
|
||||||
` projections.apps5_oidc_configs.skip_native_app_success_page,` +
|
` projections.apps6_oidc_configs.skip_native_app_success_page,` +
|
||||||
//saml config
|
//saml config
|
||||||
` projections.apps5_saml_configs.app_id,` +
|
` projections.apps6_saml_configs.app_id,` +
|
||||||
` projections.apps5_saml_configs.entity_id,` +
|
` projections.apps6_saml_configs.entity_id,` +
|
||||||
` projections.apps5_saml_configs.metadata,` +
|
` projections.apps6_saml_configs.metadata,` +
|
||||||
` projections.apps5_saml_configs.metadata_url,` +
|
` projections.apps6_saml_configs.metadata_url,` +
|
||||||
` COUNT(*) OVER ()` +
|
` COUNT(*) OVER ()` +
|
||||||
` FROM projections.apps5` +
|
` FROM projections.apps6` +
|
||||||
` LEFT JOIN projections.apps5_api_configs ON projections.apps5.id = projections.apps5_api_configs.app_id AND projections.apps5.instance_id = projections.apps5_api_configs.instance_id` +
|
` LEFT JOIN projections.apps6_api_configs ON projections.apps6.id = projections.apps6_api_configs.app_id AND projections.apps6.instance_id = projections.apps6_api_configs.instance_id` +
|
||||||
` LEFT JOIN projections.apps5_oidc_configs ON projections.apps5.id = projections.apps5_oidc_configs.app_id AND projections.apps5.instance_id = projections.apps5_oidc_configs.instance_id` +
|
` LEFT JOIN projections.apps6_oidc_configs ON projections.apps6.id = projections.apps6_oidc_configs.app_id AND projections.apps6.instance_id = projections.apps6_oidc_configs.instance_id` +
|
||||||
` LEFT JOIN projections.apps5_saml_configs ON projections.apps5.id = projections.apps5_saml_configs.app_id AND projections.apps5.instance_id = projections.apps5_saml_configs.instance_id` +
|
` LEFT JOIN projections.apps6_saml_configs ON projections.apps6.id = projections.apps6_saml_configs.app_id AND projections.apps6.instance_id = projections.apps6_saml_configs.instance_id` +
|
||||||
` AS OF SYSTEM TIME '-1 ms'`)
|
` AS OF SYSTEM TIME '-1 ms'`)
|
||||||
expectedAppIDsQuery = regexp.QuoteMeta(`SELECT projections.apps5_api_configs.client_id,` +
|
expectedAppIDsQuery = regexp.QuoteMeta(`SELECT projections.apps6_api_configs.client_id,` +
|
||||||
` projections.apps5_oidc_configs.client_id` +
|
` projections.apps6_oidc_configs.client_id` +
|
||||||
` FROM projections.apps5` +
|
` FROM projections.apps6` +
|
||||||
` LEFT JOIN projections.apps5_api_configs ON projections.apps5.id = projections.apps5_api_configs.app_id AND projections.apps5.instance_id = projections.apps5_api_configs.instance_id` +
|
` LEFT JOIN projections.apps6_api_configs ON projections.apps6.id = projections.apps6_api_configs.app_id AND projections.apps6.instance_id = projections.apps6_api_configs.instance_id` +
|
||||||
` LEFT JOIN projections.apps5_oidc_configs ON projections.apps5.id = projections.apps5_oidc_configs.app_id AND projections.apps5.instance_id = projections.apps5_oidc_configs.instance_id` +
|
` LEFT JOIN projections.apps6_oidc_configs ON projections.apps6.id = projections.apps6_oidc_configs.app_id AND projections.apps6.instance_id = projections.apps6_oidc_configs.instance_id` +
|
||||||
` AS OF SYSTEM TIME '-1 ms'`)
|
` AS OF SYSTEM TIME '-1 ms'`)
|
||||||
expectedProjectIDByAppQuery = regexp.QuoteMeta(`SELECT projections.apps5.project_id` +
|
expectedProjectIDByAppQuery = regexp.QuoteMeta(`SELECT projections.apps6.project_id` +
|
||||||
` FROM projections.apps5` +
|
` FROM projections.apps6` +
|
||||||
` LEFT JOIN projections.apps5_api_configs ON projections.apps5.id = projections.apps5_api_configs.app_id AND projections.apps5.instance_id = projections.apps5_api_configs.instance_id` +
|
` LEFT JOIN projections.apps6_api_configs ON projections.apps6.id = projections.apps6_api_configs.app_id AND projections.apps6.instance_id = projections.apps6_api_configs.instance_id` +
|
||||||
` LEFT JOIN projections.apps5_oidc_configs ON projections.apps5.id = projections.apps5_oidc_configs.app_id AND projections.apps5.instance_id = projections.apps5_oidc_configs.instance_id` +
|
` LEFT JOIN projections.apps6_oidc_configs ON projections.apps6.id = projections.apps6_oidc_configs.app_id AND projections.apps6.instance_id = projections.apps6_oidc_configs.instance_id` +
|
||||||
` LEFT JOIN projections.apps5_saml_configs ON projections.apps5.id = projections.apps5_saml_configs.app_id AND projections.apps5.instance_id = projections.apps5_saml_configs.instance_id` +
|
` LEFT JOIN projections.apps6_saml_configs ON projections.apps6.id = projections.apps6_saml_configs.app_id AND projections.apps6.instance_id = projections.apps6_saml_configs.instance_id` +
|
||||||
` AS OF SYSTEM TIME '-1 ms'`)
|
` AS OF SYSTEM TIME '-1 ms'`)
|
||||||
expectedProjectByAppQuery = regexp.QuoteMeta(`SELECT projections.projects3.id,` +
|
expectedProjectByAppQuery = regexp.QuoteMeta(`SELECT projections.projects3.id,` +
|
||||||
` projections.projects3.creation_date,` +
|
` projections.projects3.creation_date,` +
|
||||||
@ -120,10 +120,10 @@ var (
|
|||||||
` projections.projects3.has_project_check,` +
|
` projections.projects3.has_project_check,` +
|
||||||
` projections.projects3.private_labeling_setting` +
|
` projections.projects3.private_labeling_setting` +
|
||||||
` FROM projections.projects3` +
|
` FROM projections.projects3` +
|
||||||
` JOIN projections.apps5 ON projections.projects3.id = projections.apps5.project_id AND projections.projects3.instance_id = projections.apps5.instance_id` +
|
` JOIN projections.apps6 ON projections.projects3.id = projections.apps6.project_id AND projections.projects3.instance_id = projections.apps6.instance_id` +
|
||||||
` LEFT JOIN projections.apps5_api_configs ON projections.apps5.id = projections.apps5_api_configs.app_id AND projections.apps5.instance_id = projections.apps5_api_configs.instance_id` +
|
` LEFT JOIN projections.apps6_api_configs ON projections.apps6.id = projections.apps6_api_configs.app_id AND projections.apps6.instance_id = projections.apps6_api_configs.instance_id` +
|
||||||
` LEFT JOIN projections.apps5_oidc_configs ON projections.apps5.id = projections.apps5_oidc_configs.app_id AND projections.apps5.instance_id = projections.apps5_oidc_configs.instance_id` +
|
` LEFT JOIN projections.apps6_oidc_configs ON projections.apps6.id = projections.apps6_oidc_configs.app_id AND projections.apps6.instance_id = projections.apps6_oidc_configs.instance_id` +
|
||||||
` LEFT JOIN projections.apps5_saml_configs ON projections.apps5.id = projections.apps5_saml_configs.app_id AND projections.apps5.instance_id = projections.apps5_saml_configs.instance_id` +
|
` LEFT JOIN projections.apps6_saml_configs ON projections.apps6.id = projections.apps6_saml_configs.app_id AND projections.apps6.instance_id = projections.apps6_saml_configs.instance_id` +
|
||||||
` AS OF SYSTEM TIME '-1 ms'`)
|
` AS OF SYSTEM TIME '-1 ms'`)
|
||||||
|
|
||||||
appCols = database.TextArray[string]{
|
appCols = database.TextArray[string]{
|
||||||
|
@ -76,10 +76,6 @@ var (
|
|||||||
name: projection.AuthNKeyEnabledCol,
|
name: projection.AuthNKeyEnabledCol,
|
||||||
table: authNKeyTable,
|
table: authNKeyTable,
|
||||||
}
|
}
|
||||||
AuthNKeyOwnerRemovedCol = Column{
|
|
||||||
name: projection.AuthNKeyOwnerRemovedCol,
|
|
||||||
table: authNKeyTable,
|
|
||||||
}
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type AuthNKeys struct {
|
type AuthNKeys struct {
|
||||||
@ -139,9 +135,6 @@ func (q *Queries) SearchAuthNKeys(ctx context.Context, queries *AuthNKeySearchQu
|
|||||||
AuthNKeyColumnEnabled.identifier(): true,
|
AuthNKeyColumnEnabled.identifier(): true,
|
||||||
AuthNKeyColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID(),
|
AuthNKeyColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID(),
|
||||||
}
|
}
|
||||||
if !withOwnerRemoved {
|
|
||||||
eq[AuthNKeyOwnerRemovedCol.identifier()] = false
|
|
||||||
}
|
|
||||||
stmt, args, err := query.Where(eq).ToSql()
|
stmt, args, err := query.Where(eq).ToSql()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.ThrowInvalidArgument(err, "QUERY-SAf3f", "Errors.Query.InvalidRequest")
|
return nil, errors.ThrowInvalidArgument(err, "QUERY-SAf3f", "Errors.Query.InvalidRequest")
|
||||||
@ -159,7 +152,7 @@ func (q *Queries) SearchAuthNKeys(ctx context.Context, queries *AuthNKeySearchQu
|
|||||||
return authNKeys, err
|
return authNKeys, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (q *Queries) SearchAuthNKeysData(ctx context.Context, queries *AuthNKeySearchQueries, withOwnerRemoved bool) (authNKeys *AuthNKeysData, err error) {
|
func (q *Queries) SearchAuthNKeysData(ctx context.Context, queries *AuthNKeySearchQueries) (authNKeys *AuthNKeysData, err error) {
|
||||||
ctx, span := tracing.NewSpan(ctx)
|
ctx, span := tracing.NewSpan(ctx)
|
||||||
defer func() { span.EndWithError(err) }()
|
defer func() { span.EndWithError(err) }()
|
||||||
|
|
||||||
@ -169,9 +162,6 @@ func (q *Queries) SearchAuthNKeysData(ctx context.Context, queries *AuthNKeySear
|
|||||||
AuthNKeyColumnEnabled.identifier(): true,
|
AuthNKeyColumnEnabled.identifier(): true,
|
||||||
AuthNKeyColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID(),
|
AuthNKeyColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID(),
|
||||||
}
|
}
|
||||||
if !withOwnerRemoved {
|
|
||||||
eq[AuthNKeyOwnerRemovedCol.identifier()] = false
|
|
||||||
}
|
|
||||||
stmt, args, err := query.Where(eq).ToSql()
|
stmt, args, err := query.Where(eq).ToSql()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.ThrowInvalidArgument(err, "QUERY-SAg3f", "Errors.Query.InvalidRequest")
|
return nil, errors.ThrowInvalidArgument(err, "QUERY-SAg3f", "Errors.Query.InvalidRequest")
|
||||||
@ -188,7 +178,7 @@ func (q *Queries) SearchAuthNKeysData(ctx context.Context, queries *AuthNKeySear
|
|||||||
return authNKeys, err
|
return authNKeys, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (q *Queries) GetAuthNKeyByID(ctx context.Context, shouldTriggerBulk bool, id string, withOwnerRemoved bool, queries ...SearchQuery) (key *AuthNKey, err error) {
|
func (q *Queries) GetAuthNKeyByID(ctx context.Context, shouldTriggerBulk bool, id string, queries ...SearchQuery) (key *AuthNKey, err error) {
|
||||||
ctx, span := tracing.NewSpan(ctx)
|
ctx, span := tracing.NewSpan(ctx)
|
||||||
defer func() { span.EndWithError(err) }()
|
defer func() { span.EndWithError(err) }()
|
||||||
|
|
||||||
@ -208,9 +198,6 @@ func (q *Queries) GetAuthNKeyByID(ctx context.Context, shouldTriggerBulk bool, i
|
|||||||
AuthNKeyColumnEnabled.identifier(): true,
|
AuthNKeyColumnEnabled.identifier(): true,
|
||||||
AuthNKeyColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID(),
|
AuthNKeyColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID(),
|
||||||
}
|
}
|
||||||
if !withOwnerRemoved {
|
|
||||||
eq[AuthNKeyOwnerRemovedCol.identifier()] = false
|
|
||||||
}
|
|
||||||
stmt, args, err := query.Where(eq).ToSql()
|
stmt, args, err := query.Where(eq).ToSql()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.ThrowInternal(err, "QUERY-AGhg4", "Errors.Query.SQLStatement")
|
return nil, errors.ThrowInternal(err, "QUERY-AGhg4", "Errors.Query.SQLStatement")
|
||||||
@ -239,20 +226,6 @@ func (q *Queries) GetAuthNKeyPublicKeyByIDAndIdentifier(ctx context.Context, id
|
|||||||
AuthNKeyColumnExpiration.identifier(): time.Now(),
|
AuthNKeyColumnExpiration.identifier(): time.Now(),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
if !withOwnerRemoved {
|
|
||||||
eq = sq.And{
|
|
||||||
sq.Eq{
|
|
||||||
AuthNKeyColumnID.identifier(): id,
|
|
||||||
AuthNKeyColumnIdentifier.identifier(): identifier,
|
|
||||||
AuthNKeyColumnEnabled.identifier(): true,
|
|
||||||
AuthNKeyColumnInstanceID.identifier(): authz.GetInstance(ctx).InstanceID(),
|
|
||||||
AuthNKeyOwnerRemovedCol.identifier(): false,
|
|
||||||
},
|
|
||||||
sq.Gt{
|
|
||||||
AuthNKeyColumnExpiration.identifier(): time.Now(),
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
query, args, err := stmt.Where(eq).ToSql()
|
query, args, err := stmt.Where(eq).ToSql()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.ThrowInternal(err, "QUERY-DAb32", "Errors.Query.SQLStatement")
|
return nil, errors.ThrowInternal(err, "QUERY-DAb32", "Errors.Query.SQLStatement")
|
||||||
|
@ -20,5 +20,4 @@ keys as (
|
|||||||
)
|
)
|
||||||
select apps.project_id, config.client_secret, keys.public_keys from config
|
select apps.project_id, config.client_secret, keys.public_keys from config
|
||||||
join projections.apps5 apps on apps.id = config.app_id
|
join projections.apps5 apps on apps.id = config.app_id
|
||||||
left join keys on keys.client_id = config.client_id
|
left join keys on keys.client_id = config.client_id;
|
||||||
where apps.owner_removed = false;
|
|
||||||
|
@ -15,7 +15,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
AppProjectionTable = "projections.apps5"
|
AppProjectionTable = "projections.apps6"
|
||||||
AppAPITable = AppProjectionTable + "_" + appAPITableSuffix
|
AppAPITable = AppProjectionTable + "_" + appAPITableSuffix
|
||||||
AppOIDCTable = AppProjectionTable + "_" + appOIDCTableSuffix
|
AppOIDCTable = AppProjectionTable + "_" + appOIDCTableSuffix
|
||||||
AppSAMLTable = AppProjectionTable + "_" + appSAMLTableSuffix
|
AppSAMLTable = AppProjectionTable + "_" + appSAMLTableSuffix
|
||||||
@ -29,7 +29,6 @@ const (
|
|||||||
AppColumnInstanceID = "instance_id"
|
AppColumnInstanceID = "instance_id"
|
||||||
AppColumnState = "state"
|
AppColumnState = "state"
|
||||||
AppColumnSequence = "sequence"
|
AppColumnSequence = "sequence"
|
||||||
AppColumnOwnerRemoved = "owner_removed"
|
|
||||||
|
|
||||||
appAPITableSuffix = "api_configs"
|
appAPITableSuffix = "api_configs"
|
||||||
AppAPIConfigColumnAppID = "app_id"
|
AppAPIConfigColumnAppID = "app_id"
|
||||||
@ -89,11 +88,9 @@ func (*appProjection) Init() *old_handler.Check {
|
|||||||
handler.NewColumn(AppColumnInstanceID, handler.ColumnTypeText),
|
handler.NewColumn(AppColumnInstanceID, handler.ColumnTypeText),
|
||||||
handler.NewColumn(AppColumnState, handler.ColumnTypeEnum),
|
handler.NewColumn(AppColumnState, handler.ColumnTypeEnum),
|
||||||
handler.NewColumn(AppColumnSequence, handler.ColumnTypeInt64),
|
handler.NewColumn(AppColumnSequence, handler.ColumnTypeInt64),
|
||||||
handler.NewColumn(AppColumnOwnerRemoved, handler.ColumnTypeBool, handler.Default(false)),
|
|
||||||
},
|
},
|
||||||
handler.NewPrimaryKey(AppColumnInstanceID, AppColumnID),
|
handler.NewPrimaryKey(AppColumnInstanceID, AppColumnID),
|
||||||
handler.WithIndex(handler.NewIndex("project_id", []string{AppColumnProjectID})),
|
handler.WithIndex(handler.NewIndex("project_id", []string{AppColumnProjectID})),
|
||||||
handler.WithIndex(handler.NewIndex("owner_removed", []string{AppColumnOwnerRemoved})),
|
|
||||||
),
|
),
|
||||||
handler.NewSuffixedTable([]*handler.InitColumn{
|
handler.NewSuffixedTable([]*handler.InitColumn{
|
||||||
handler.NewColumn(AppAPIConfigColumnAppID, handler.ColumnTypeText),
|
handler.NewColumn(AppAPIConfigColumnAppID, handler.ColumnTypeText),
|
||||||
|
@ -46,7 +46,7 @@ func TestAppProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "INSERT INTO projections.apps5 (id, name, project_id, creation_date, change_date, resource_owner, instance_id, state, sequence) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
|
expectedStmt: "INSERT INTO projections.apps6 (id, name, project_id, creation_date, change_date, resource_owner, instance_id, state, sequence) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"app-id",
|
"app-id",
|
||||||
"my-app",
|
"my-app",
|
||||||
@ -83,7 +83,7 @@ func TestAppProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.apps5 SET (name, change_date, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
|
expectedStmt: "UPDATE projections.apps6 SET (name, change_date, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"my-app",
|
"my-app",
|
||||||
anyArg{},
|
anyArg{},
|
||||||
@ -136,7 +136,7 @@ func TestAppProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.apps5 SET (state, change_date, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
|
expectedStmt: "UPDATE projections.apps6 SET (state, change_date, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
domain.AppStateInactive,
|
domain.AppStateInactive,
|
||||||
anyArg{},
|
anyArg{},
|
||||||
@ -168,7 +168,7 @@ func TestAppProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.apps5 SET (state, change_date, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
|
expectedStmt: "UPDATE projections.apps6 SET (state, change_date, sequence) = ($1, $2, $3) WHERE (id = $4) AND (instance_id = $5)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
domain.AppStateActive,
|
domain.AppStateActive,
|
||||||
anyArg{},
|
anyArg{},
|
||||||
@ -200,7 +200,7 @@ func TestAppProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "DELETE FROM projections.apps5 WHERE (id = $1) AND (instance_id = $2)",
|
expectedStmt: "DELETE FROM projections.apps6 WHERE (id = $1) AND (instance_id = $2)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"app-id",
|
"app-id",
|
||||||
"instance-id",
|
"instance-id",
|
||||||
@ -227,7 +227,7 @@ func TestAppProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "DELETE FROM projections.apps5 WHERE (project_id = $1) AND (instance_id = $2)",
|
expectedStmt: "DELETE FROM projections.apps6 WHERE (project_id = $1) AND (instance_id = $2)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"agg-id",
|
"agg-id",
|
||||||
"instance-id",
|
"instance-id",
|
||||||
@ -254,7 +254,7 @@ func TestAppProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "DELETE FROM projections.apps5 WHERE (instance_id = $1)",
|
expectedStmt: "DELETE FROM projections.apps6 WHERE (instance_id = $1)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"agg-id",
|
"agg-id",
|
||||||
},
|
},
|
||||||
@ -285,7 +285,7 @@ func TestAppProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "INSERT INTO projections.apps5_api_configs (app_id, instance_id, client_id, client_secret, auth_method) VALUES ($1, $2, $3, $4, $5)",
|
expectedStmt: "INSERT INTO projections.apps6_api_configs (app_id, instance_id, client_id, client_secret, auth_method) VALUES ($1, $2, $3, $4, $5)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"app-id",
|
"app-id",
|
||||||
"instance-id",
|
"instance-id",
|
||||||
@ -295,7 +295,7 @@ func TestAppProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.apps5 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.apps6 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
uint64(15),
|
uint64(15),
|
||||||
@ -329,7 +329,7 @@ func TestAppProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.apps5_api_configs SET (client_secret, auth_method) = ($1, $2) WHERE (app_id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.apps6_api_configs SET (client_secret, auth_method) = ($1, $2) WHERE (app_id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
domain.APIAuthMethodTypePrivateKeyJWT,
|
domain.APIAuthMethodTypePrivateKeyJWT,
|
||||||
@ -338,7 +338,7 @@ func TestAppProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.apps5 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.apps6 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
uint64(15),
|
uint64(15),
|
||||||
@ -391,7 +391,7 @@ func TestAppProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.apps5_api_configs SET client_secret = $1 WHERE (app_id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.apps6_api_configs SET client_secret = $1 WHERE (app_id = $2) AND (instance_id = $3)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
"app-id",
|
"app-id",
|
||||||
@ -399,7 +399,7 @@ func TestAppProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.apps5 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.apps6 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
uint64(15),
|
uint64(15),
|
||||||
@ -447,7 +447,7 @@ func TestAppProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "INSERT INTO projections.apps5_oidc_configs (app_id, instance_id, version, client_id, client_secret, redirect_uris, response_types, grant_types, application_type, auth_method_type, post_logout_redirect_uris, is_dev_mode, access_token_type, access_token_role_assertion, id_token_role_assertion, id_token_userinfo_assertion, clock_skew, additional_origins, skip_native_app_success_page) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19)",
|
expectedStmt: "INSERT INTO projections.apps6_oidc_configs (app_id, instance_id, version, client_id, client_secret, redirect_uris, response_types, grant_types, application_type, auth_method_type, post_logout_redirect_uris, is_dev_mode, access_token_type, access_token_role_assertion, id_token_role_assertion, id_token_userinfo_assertion, clock_skew, additional_origins, skip_native_app_success_page) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15, $16, $17, $18, $19)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"app-id",
|
"app-id",
|
||||||
"instance-id",
|
"instance-id",
|
||||||
@ -471,7 +471,7 @@ func TestAppProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.apps5 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.apps6 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
uint64(15),
|
uint64(15),
|
||||||
@ -518,7 +518,7 @@ func TestAppProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.apps5_oidc_configs SET (version, redirect_uris, response_types, grant_types, application_type, auth_method_type, post_logout_redirect_uris, is_dev_mode, access_token_type, access_token_role_assertion, id_token_role_assertion, id_token_userinfo_assertion, clock_skew, additional_origins, skip_native_app_success_page) = ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15) WHERE (app_id = $16) AND (instance_id = $17)",
|
expectedStmt: "UPDATE projections.apps6_oidc_configs SET (version, redirect_uris, response_types, grant_types, application_type, auth_method_type, post_logout_redirect_uris, is_dev_mode, access_token_type, access_token_role_assertion, id_token_role_assertion, id_token_userinfo_assertion, clock_skew, additional_origins, skip_native_app_success_page) = ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14, $15) WHERE (app_id = $16) AND (instance_id = $17)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
domain.OIDCVersionV1,
|
domain.OIDCVersionV1,
|
||||||
database.TextArray[string]{"redirect.one.ch", "redirect.two.ch"},
|
database.TextArray[string]{"redirect.one.ch", "redirect.two.ch"},
|
||||||
@ -540,7 +540,7 @@ func TestAppProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.apps5 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.apps6 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
uint64(15),
|
uint64(15),
|
||||||
@ -593,7 +593,7 @@ func TestAppProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.apps5_oidc_configs SET client_secret = $1 WHERE (app_id = $2) AND (instance_id = $3)",
|
expectedStmt: "UPDATE projections.apps6_oidc_configs SET client_secret = $1 WHERE (app_id = $2) AND (instance_id = $3)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
"app-id",
|
"app-id",
|
||||||
@ -601,7 +601,7 @@ func TestAppProjection_reduces(t *testing.T) {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
expectedStmt: "UPDATE projections.apps5 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
expectedStmt: "UPDATE projections.apps6 SET (change_date, sequence) = ($1, $2) WHERE (id = $3) AND (instance_id = $4)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
anyArg{},
|
anyArg{},
|
||||||
uint64(15),
|
uint64(15),
|
||||||
@ -630,7 +630,7 @@ func TestAppProjection_reduces(t *testing.T) {
|
|||||||
executer: &testExecuter{
|
executer: &testExecuter{
|
||||||
executions: []execution{
|
executions: []execution{
|
||||||
{
|
{
|
||||||
expectedStmt: "DELETE FROM projections.apps5 WHERE (instance_id = $1) AND (resource_owner = $2)",
|
expectedStmt: "DELETE FROM projections.apps6 WHERE (instance_id = $1) AND (resource_owner = $2)",
|
||||||
expectedArgs: []interface{}{
|
expectedArgs: []interface{}{
|
||||||
"instance-id",
|
"instance-id",
|
||||||
"agg-id",
|
"agg-id",
|
||||||
|
@ -30,7 +30,6 @@ const (
|
|||||||
AuthNKeyPublicKeyCol = "public_key"
|
AuthNKeyPublicKeyCol = "public_key"
|
||||||
AuthNKeyTypeCol = "type"
|
AuthNKeyTypeCol = "type"
|
||||||
AuthNKeyEnabledCol = "enabled"
|
AuthNKeyEnabledCol = "enabled"
|
||||||
AuthNKeyOwnerRemovedCol = "owner_removed"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type authNKeyProjection struct{}
|
type authNKeyProjection struct{}
|
||||||
@ -59,12 +58,10 @@ func (*authNKeyProjection) Init() *old_handler.Check {
|
|||||||
handler.NewColumn(AuthNKeyPublicKeyCol, handler.ColumnTypeBytes),
|
handler.NewColumn(AuthNKeyPublicKeyCol, handler.ColumnTypeBytes),
|
||||||
handler.NewColumn(AuthNKeyEnabledCol, handler.ColumnTypeBool, handler.Default(true)),
|
handler.NewColumn(AuthNKeyEnabledCol, handler.ColumnTypeBool, handler.Default(true)),
|
||||||
handler.NewColumn(AuthNKeyTypeCol, handler.ColumnTypeEnum, handler.Default(0)),
|
handler.NewColumn(AuthNKeyTypeCol, handler.ColumnTypeEnum, handler.Default(0)),
|
||||||
handler.NewColumn(AuthNKeyOwnerRemovedCol, handler.ColumnTypeBool, handler.Default(false)),
|
|
||||||
},
|
},
|
||||||
handler.NewPrimaryKey(AuthNKeyInstanceIDCol, AuthNKeyIDCol),
|
handler.NewPrimaryKey(AuthNKeyInstanceIDCol, AuthNKeyIDCol),
|
||||||
handler.WithIndex(handler.NewIndex("enabled", []string{AuthNKeyEnabledCol})),
|
handler.WithIndex(handler.NewIndex("enabled", []string{AuthNKeyEnabledCol})),
|
||||||
handler.WithIndex(handler.NewIndex("identifier", []string{AuthNKeyIdentifierCol})),
|
handler.WithIndex(handler.NewIndex("identifier", []string{AuthNKeyIdentifierCol})),
|
||||||
handler.WithIndex(handler.NewIndex("owner_removed", []string{AuthNKeyOwnerRemovedCol})),
|
|
||||||
),
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user