2020-05-18 12:06:36 +02:00
|
|
|
package repository
|
|
|
|
|
|
|
|
import (
|
|
|
|
"context"
|
2020-07-01 07:18:05 +02:00
|
|
|
|
2020-06-15 14:57:19 +02:00
|
|
|
org_model "github.com/caos/zitadel/internal/org/model"
|
2020-05-18 12:06:36 +02:00
|
|
|
|
|
|
|
"github.com/caos/zitadel/internal/user/model"
|
|
|
|
)
|
|
|
|
|
|
|
|
type UserRepository interface {
|
2020-06-15 14:57:19 +02:00
|
|
|
Register(ctx context.Context, user *model.User, member *org_model.OrgMember, resourceOwner string) (*model.User, error)
|
2020-09-18 13:26:28 +02:00
|
|
|
RegisterExternalUser(ctx context.Context, user *model.User, externalIDP *model.ExternalIDP, member *org_model.OrgMember, resourceOwner string) (*model.User, error)
|
2020-05-18 12:06:36 +02:00
|
|
|
|
|
|
|
myUserRepo
|
2020-12-02 17:00:04 +01:00
|
|
|
SkipMFAInit(ctx context.Context, userID string) error
|
2020-06-05 07:50:04 +02:00
|
|
|
|
2020-05-18 12:06:36 +02:00
|
|
|
RequestPasswordReset(ctx context.Context, username string) error
|
2020-12-07 12:09:10 +01:00
|
|
|
SetPassword(ctx context.Context, userID, code, password, userAgentID string) error
|
|
|
|
ChangePassword(ctx context.Context, userID, old, new, userAgentID string) error
|
2020-06-05 07:50:04 +02:00
|
|
|
|
|
|
|
VerifyEmail(ctx context.Context, userID, code string) error
|
|
|
|
ResendEmailVerificationMail(ctx context.Context, userID string) error
|
|
|
|
|
2020-08-27 17:18:23 +02:00
|
|
|
VerifyInitCode(ctx context.Context, userID, code, password string) error
|
|
|
|
ResendInitVerificationMail(ctx context.Context, userID string) error
|
|
|
|
|
2020-12-02 17:00:04 +01:00
|
|
|
AddMFAOTP(ctx context.Context, userID string) (*model.OTP, error)
|
2020-12-07 12:09:10 +01:00
|
|
|
VerifyMFAOTPSetup(ctx context.Context, userID, code, userAgentID string) error
|
2020-12-02 17:00:04 +01:00
|
|
|
|
|
|
|
AddMFAU2F(ctx context.Context, id string) (*model.WebAuthNToken, error)
|
2020-12-07 12:09:10 +01:00
|
|
|
VerifyMFAU2FSetup(ctx context.Context, userID, tokenName, userAgentID string, credentialData []byte) error
|
2020-12-02 17:00:04 +01:00
|
|
|
RemoveMFAU2F(ctx context.Context, userID, webAuthNTokenID string) error
|
|
|
|
|
2020-12-15 16:44:16 +01:00
|
|
|
GetPasswordless(ctx context.Context, id string) ([]*model.WebAuthNToken, error)
|
2020-12-02 17:00:04 +01:00
|
|
|
AddPasswordless(ctx context.Context, id string) (*model.WebAuthNToken, error)
|
2020-12-07 12:09:10 +01:00
|
|
|
VerifyPasswordlessSetup(ctx context.Context, userID, tokenName, userAgentID string, credentialData []byte) error
|
2020-12-02 17:00:04 +01:00
|
|
|
RemovePasswordless(ctx context.Context, userID, webAuthNTokenID string) error
|
2020-05-18 12:06:36 +02:00
|
|
|
|
2020-08-27 17:18:23 +02:00
|
|
|
ChangeUsername(ctx context.Context, userID, username string) error
|
|
|
|
|
2020-06-29 09:49:40 +02:00
|
|
|
SignOut(ctx context.Context, agentID string) error
|
2020-06-05 07:50:04 +02:00
|
|
|
|
2020-06-17 07:25:04 +02:00
|
|
|
UserByID(ctx context.Context, userID string) (*model.UserView, error)
|
2020-09-17 08:49:33 +02:00
|
|
|
|
|
|
|
MachineKeyByID(ctx context.Context, keyID string) (*model.MachineKeyView, error)
|
2020-05-18 12:06:36 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
type myUserRepo interface {
|
2020-06-17 16:43:53 +02:00
|
|
|
MyUser(ctx context.Context) (*model.UserView, error)
|
|
|
|
|
2020-05-18 12:06:36 +02:00
|
|
|
MyProfile(ctx context.Context) (*model.Profile, error)
|
|
|
|
ChangeMyProfile(ctx context.Context, profile *model.Profile) (*model.Profile, error)
|
|
|
|
|
|
|
|
MyEmail(ctx context.Context) (*model.Email, error)
|
|
|
|
ChangeMyEmail(ctx context.Context, email *model.Email) (*model.Email, error)
|
|
|
|
VerifyMyEmail(ctx context.Context, code string) error
|
|
|
|
ResendMyEmailVerificationMail(ctx context.Context) error
|
|
|
|
|
|
|
|
MyPhone(ctx context.Context) (*model.Phone, error)
|
|
|
|
ChangeMyPhone(ctx context.Context, phone *model.Phone) (*model.Phone, error)
|
2020-07-06 15:48:24 +02:00
|
|
|
RemoveMyPhone(ctx context.Context) error
|
2020-05-18 12:06:36 +02:00
|
|
|
VerifyMyPhone(ctx context.Context, code string) error
|
|
|
|
ResendMyPhoneVerificationCode(ctx context.Context) error
|
|
|
|
|
|
|
|
MyAddress(ctx context.Context) (*model.Address, error)
|
|
|
|
ChangeMyAddress(ctx context.Context, address *model.Address) (*model.Address, error)
|
|
|
|
|
|
|
|
ChangeMyPassword(ctx context.Context, old, new string) error
|
|
|
|
|
2020-09-18 13:26:28 +02:00
|
|
|
SearchMyExternalIDPs(ctx context.Context, request *model.ExternalIDPSearchRequest) (*model.ExternalIDPSearchResponse, error)
|
|
|
|
AddMyExternalIDP(ctx context.Context, externalIDP *model.ExternalIDP) (*model.ExternalIDP, error)
|
|
|
|
RemoveMyExternalIDP(ctx context.Context, externalIDP *model.ExternalIDP) error
|
|
|
|
|
2020-12-02 17:00:04 +01:00
|
|
|
MyUserMFAs(ctx context.Context) ([]*model.MultiFactor, error)
|
|
|
|
AddMyMFAOTP(ctx context.Context) (*model.OTP, error)
|
|
|
|
VerifyMyMFAOTPSetup(ctx context.Context, code string) error
|
|
|
|
RemoveMyMFAOTP(ctx context.Context) error
|
|
|
|
|
|
|
|
AddMyMFAU2F(ctx context.Context) (*model.WebAuthNToken, error)
|
|
|
|
VerifyMyMFAU2FSetup(ctx context.Context, tokenName string, data []byte) error
|
|
|
|
RemoveMyMFAU2F(ctx context.Context, webAuthNTokenID string) error
|
|
|
|
|
2020-12-15 16:44:16 +01:00
|
|
|
GetMyPasswordless(ctx context.Context) ([]*model.WebAuthNToken, error)
|
2020-12-02 17:00:04 +01:00
|
|
|
AddMyPasswordless(ctx context.Context) (*model.WebAuthNToken, error)
|
|
|
|
VerifyMyPasswordlessSetup(ctx context.Context, tokenName string, data []byte) error
|
|
|
|
RemoveMyPasswordless(ctx context.Context, webAuthNTokenID string) error
|
2020-07-01 07:18:05 +02:00
|
|
|
|
2020-08-27 17:18:23 +02:00
|
|
|
ChangeMyUsername(ctx context.Context, username string) error
|
|
|
|
|
2020-07-01 07:18:05 +02:00
|
|
|
MyUserChanges(ctx context.Context, lastSequence uint64, limit uint64, sortAscending bool) (*model.UserChanges, error)
|
2020-05-18 12:06:36 +02:00
|
|
|
}
|