mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 17:27:31 +00:00
feat: Instance commands (#3385)
* fix: add events for domain * fix: add/remove domain command side * fix: add/remove domain command side * fix: add/remove domain query side * fix: create instance * fix: merge v2 * fix: instance domain * fix: instance domain * fix: instance domain * fix: instance domain * fix: remove domain.IAMID from writemodels * fix: remove domain.IAMID from writemodels * fix: remove domain.IAMID from writemodels * fix: remove domain.IAMID from writemodels * fix: remove domain.IAMID from writemodels * fix: remove domain.IAMID from writemodels * fix: remove domain.IAMID from writemodels * fix: remove domain.IAMID from writemodels * fix: remove domain.IAMID from writemodels * fix: remove domain.IAMID from api * fix: remove domain.IAMID * fix: remove domain.IAMID * fix: add instance domain queries * fix: fix after merge * Update auth_request.go * fix keypair * remove unused code * feat: read instance id from context * feat: remove unused code * feat: use instance id from context * some fixes Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
13
internal/auth_request/repository/cache/cache.go
vendored
13
internal/auth_request/repository/cache/cache.go
vendored
@@ -8,6 +8,7 @@ import (
|
||||
"fmt"
|
||||
"time"
|
||||
|
||||
"github.com/caos/zitadel/internal/api/authz"
|
||||
"github.com/caos/zitadel/internal/domain"
|
||||
caos_errs "github.com/caos/zitadel/internal/errors"
|
||||
)
|
||||
@@ -26,12 +27,12 @@ func (c *AuthRequestCache) Health(ctx context.Context) error {
|
||||
return c.client.PingContext(ctx)
|
||||
}
|
||||
|
||||
func (c *AuthRequestCache) GetAuthRequestByID(_ context.Context, id, instanceID string) (*domain.AuthRequest, error) {
|
||||
return c.getAuthRequest("id", id, instanceID)
|
||||
func (c *AuthRequestCache) GetAuthRequestByID(ctx context.Context, id string) (*domain.AuthRequest, error) {
|
||||
return c.getAuthRequest("id", id, authz.GetInstance(ctx).InstanceID())
|
||||
}
|
||||
|
||||
func (c *AuthRequestCache) GetAuthRequestByCode(_ context.Context, code, instanceID string) (*domain.AuthRequest, error) {
|
||||
return c.getAuthRequest("code", code, instanceID)
|
||||
func (c *AuthRequestCache) GetAuthRequestByCode(ctx context.Context, code string) (*domain.AuthRequest, error) {
|
||||
return c.getAuthRequest("code", code, authz.GetInstance(ctx).InstanceID())
|
||||
}
|
||||
|
||||
func (c *AuthRequestCache) SaveAuthRequest(_ context.Context, request *domain.AuthRequest) error {
|
||||
@@ -45,8 +46,8 @@ func (c *AuthRequestCache) UpdateAuthRequest(_ context.Context, request *domain.
|
||||
return c.saveAuthRequest(request, "UPDATE auth.auth_requests SET request = $2, instance_id = $3, change_date = $4, code = $5 WHERE id = $1", request.ChangeDate, request.Code)
|
||||
}
|
||||
|
||||
func (c *AuthRequestCache) DeleteAuthRequest(_ context.Context, id, instanceID string) error {
|
||||
_, err := c.client.Exec("DELETE FROM auth.auth_requests WHERE instance_id = $1 and id = $2", instanceID, id)
|
||||
func (c *AuthRequestCache) DeleteAuthRequest(ctx context.Context, id string) error {
|
||||
_, err := c.client.Exec("DELETE FROM auth.auth_requests WHERE instance_id = $1 and id = $2", authz.GetInstance(ctx).InstanceID(), id)
|
||||
if err != nil {
|
||||
return caos_errs.ThrowInternal(err, "CACHE-dsHw3", "unable to delete auth request")
|
||||
}
|
||||
|
@@ -9,9 +9,9 @@ import (
|
||||
type AuthRequestCache interface {
|
||||
Health(ctx context.Context) error
|
||||
|
||||
GetAuthRequestByID(ctx context.Context, id, instanceID string) (*domain.AuthRequest, error)
|
||||
GetAuthRequestByCode(ctx context.Context, code, instanceID string) (*domain.AuthRequest, error)
|
||||
GetAuthRequestByID(ctx context.Context, id string) (*domain.AuthRequest, error)
|
||||
GetAuthRequestByCode(ctx context.Context, code string) (*domain.AuthRequest, error)
|
||||
SaveAuthRequest(ctx context.Context, request *domain.AuthRequest) error
|
||||
UpdateAuthRequest(ctx context.Context, request *domain.AuthRequest) error
|
||||
DeleteAuthRequest(ctx context.Context, id, instanceID string) error
|
||||
DeleteAuthRequest(ctx context.Context, id string) error
|
||||
}
|
||||
|
Reference in New Issue
Block a user