mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-12 01:37:31 +00:00
feat: on logout we terminate all sessions from agent (#288)
* feat: on logout we terminate all sessions from agent * Update eventstore.go Co-authored-by: Livio Amstutz <livio.a@gmail.com>
This commit is contained in:
@@ -227,8 +227,16 @@ func (repo *UserRepo) SetPassword(ctx context.Context, userID, code, password st
|
||||
return repo.UserEvents.SetPassword(ctx, policy, userID, code, password)
|
||||
}
|
||||
|
||||
func (repo *UserRepo) SignOut(ctx context.Context, agentID, userID string) error {
|
||||
return repo.UserEvents.SignOut(ctx, agentID, userID)
|
||||
func (repo *UserRepo) SignOut(ctx context.Context, agentID string) error {
|
||||
userSessions, err := repo.View.UserSessionsByAgentID(agentID)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
userIDs := make([]string, len(userSessions))
|
||||
for i, session := range userSessions {
|
||||
userIDs[i] = session.UserID
|
||||
}
|
||||
return repo.UserEvents.SignOut(ctx, agentID, userIDs)
|
||||
}
|
||||
|
||||
func (repo *UserRepo) UserByID(ctx context.Context, id string) (*model.UserView, error) {
|
||||
|
@@ -23,7 +23,7 @@ type UserRepository interface {
|
||||
AddMfaOTP(ctx context.Context, userID string) (*model.OTP, error)
|
||||
VerifyMfaOTPSetup(ctx context.Context, userID, code string) error
|
||||
|
||||
SignOut(ctx context.Context, agentID, userID string) error
|
||||
SignOut(ctx context.Context, agentID string) error
|
||||
|
||||
UserByID(ctx context.Context, userID string) (*model.UserView, error)
|
||||
}
|
||||
|
Reference in New Issue
Block a user