mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 21:17:32 +00:00
feat: v2 api add way to list authentication factors (#9065)
# Which Problems Are Solved The v2 api currently has no endpoint the get all second factors of a user. # How the Problems Are Solved Our v1 api has the ListHumanAuthFactors which got added to the v2 api under the User resource. # Additional Changes # Additional Context Closes #8833 --------- Co-authored-by: Stefan Benz <46600784+stebenz@users.noreply.github.com>
This commit is contained in:
@@ -327,7 +327,7 @@ func (i *Instance) CreateUserIDPlink(ctx context.Context, userID, externalID, id
|
||||
)
|
||||
}
|
||||
|
||||
func (i *Instance) RegisterUserPasskey(ctx context.Context, userID string) {
|
||||
func (i *Instance) RegisterUserPasskey(ctx context.Context, userID string) string {
|
||||
reg, err := i.Client.UserV2.CreatePasskeyRegistrationLink(ctx, &user_v2.CreatePasskeyRegistrationLinkRequest{
|
||||
UserId: userID,
|
||||
Medium: &user_v2.CreatePasskeyRegistrationLinkRequest_ReturnCode{},
|
||||
@@ -350,9 +350,10 @@ func (i *Instance) RegisterUserPasskey(ctx context.Context, userID string) {
|
||||
PasskeyName: "nice name",
|
||||
})
|
||||
logging.OnError(err).Panic("create user passkey")
|
||||
return pkr.GetPasskeyId()
|
||||
}
|
||||
|
||||
func (i *Instance) RegisterUserU2F(ctx context.Context, userID string) {
|
||||
func (i *Instance) RegisterUserU2F(ctx context.Context, userID string) string {
|
||||
pkr, err := i.Client.UserV2.RegisterU2F(ctx, &user_v2.RegisterU2FRequest{
|
||||
UserId: userID,
|
||||
Domain: i.Domain,
|
||||
@@ -368,6 +369,21 @@ func (i *Instance) RegisterUserU2F(ctx context.Context, userID string) {
|
||||
TokenName: "nice name",
|
||||
})
|
||||
logging.OnError(err).Panic("create user u2f")
|
||||
return pkr.GetU2FId()
|
||||
}
|
||||
|
||||
func (i *Instance) RegisterUserOTPSMS(ctx context.Context, userID string) {
|
||||
_, err := i.Client.UserV2.AddOTPSMS(ctx, &user_v2.AddOTPSMSRequest{
|
||||
UserId: userID,
|
||||
})
|
||||
logging.OnError(err).Panic("create user sms")
|
||||
}
|
||||
|
||||
func (i *Instance) RegisterUserOTPEmail(ctx context.Context, userID string) {
|
||||
_, err := i.Client.UserV2.AddOTPEmail(ctx, &user_v2.AddOTPEmailRequest{
|
||||
UserId: userID,
|
||||
})
|
||||
logging.OnError(err).Panic("create user email")
|
||||
}
|
||||
|
||||
func (i *Instance) SetUserPassword(ctx context.Context, userID, password string, changeRequired bool) *object.Details {
|
||||
|
Reference in New Issue
Block a user