fix: passwordless (#1112)

* fix token list

* fix token name

* i18n
This commit is contained in:
Livio Amstutz 2020-12-17 08:17:02 +01:00 committed by GitHub
parent 6aa0588fe0
commit 055cdf98ed
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
6 changed files with 40 additions and 31 deletions

View File

@ -67,7 +67,7 @@ export ZITADEL_SHORT_CACHE_SHARED_MAXAGE=15m
export ZITADEL_CONSOLE_ENV_DIR=../../console/src/assets/ export ZITADEL_CONSOLE_ENV_DIR=../../console/src/assets/
#Org #Org
export ZITADEL_DEFAULT_DOMAIN=zitadel.ch export ZITADEL_DEFAULT_DOMAIN=localhost
#Setup #Setup

View File

@ -160,12 +160,12 @@
"TITLE": "Passwortlose Authentifizierungsmethoden", "TITLE": "Passwortlose Authentifizierungsmethoden",
"DESCRIPTION": "Füge WebAuthn kompatible Authentifikatoren hinzu um dich passwortlos anzumelden.", "DESCRIPTION": "Füge WebAuthn kompatible Authentifikatoren hinzu um dich passwortlos anzumelden.",
"MANAGE_DESCRIPTION": "Verwalte die Multifaktor-Merkmale Deiner Benutzer.", "MANAGE_DESCRIPTION": "Verwalte die Multifaktor-Merkmale Deiner Benutzer.",
"U2F":"U2F hinzufügen", "U2F":"Authentifikator hinzufügen",
"U2F_DIALOG_TITLE": "U2F hinzufügen", "U2F_DIALOG_TITLE": "Authentifikator hinzufügen",
"U2F_DIALOG_DESCRIPTION": "Gib einen Namen für den von dir verwendeten Login an.", "U2F_DIALOG_DESCRIPTION": "Gib einen Namen für den von dir verwendeten Login an.",
"U2F_SUCCESS":"Passwordless erfolgreich erstellt!", "U2F_SUCCESS":"Passwordless erfolgreich erstellt!",
"U2F_ERROR":"Ein Fehler ist aufgetreten!", "U2F_ERROR":"Ein Fehler ist aufgetreten!",
"U2F_NAME":"U2F Name", "U2F_NAME":"Authentifikator Name",
"TYPE": { "TYPE": {
"0":"Keine MFA definiert", "0":"Keine MFA definiert",
"1":"OTP", "1":"OTP",

View File

@ -160,12 +160,12 @@
"TITLE": "Passwordless Authentication", "TITLE": "Passwordless Authentication",
"DESCRIPTION": "Add WebAuthn based Authentication Methods to log onto ZITADEL passwordless.", "DESCRIPTION": "Add WebAuthn based Authentication Methods to log onto ZITADEL passwordless.",
"MANAGE_DESCRIPTION": "Manage the second factor methods of your users.", "MANAGE_DESCRIPTION": "Manage the second factor methods of your users.",
"U2F":"Add U2F", "U2F":"Add authenticator",
"U2F_DIALOG_TITLE": "Verify U2F", "U2F_DIALOG_TITLE": "Verify authenticator",
"U2F_DIALOG_DESCRIPTION": "Enter a name for your used passwordless Login", "U2F_DIALOG_DESCRIPTION": "Enter a name for your used passwordless Login",
"U2F_SUCCESS":"Passwordless Auth created successfully!", "U2F_SUCCESS":"Passwordless Auth created successfully!",
"U2F_ERROR":"An error during U2F setup occurred!", "U2F_ERROR":"An error during U2F setup occurred!",
"U2F_NAME":"U2F Name", "U2F_NAME":"Authenticator Name",
"TYPE": { "TYPE": {
"0": "No MFA defined", "0": "No MFA defined",
"1": "OTP", "1": "OTP",

View File

@ -163,6 +163,9 @@ func (s *Server) RemoveMfaOTP(ctx context.Context, _ *empty.Empty) (_ *empty.Emp
func (s *Server) AddMyMfaU2F(ctx context.Context, _ *empty.Empty) (_ *auth.WebAuthNResponse, err error) { func (s *Server) AddMyMfaU2F(ctx context.Context, _ *empty.Empty) (_ *auth.WebAuthNResponse, err error) {
u2f, err := s.repo.AddMyMFAU2F(ctx) u2f, err := s.repo.AddMyMFAU2F(ctx)
if err != nil {
return nil, err
}
return verifyWebAuthNFromModel(u2f), err return verifyWebAuthNFromModel(u2f), err
} }
@ -186,6 +189,9 @@ func (s *Server) GetMyPasswordless(ctx context.Context, _ *empty.Empty) (_ *auth
func (s *Server) AddMyPasswordless(ctx context.Context, _ *empty.Empty) (_ *auth.WebAuthNResponse, err error) { func (s *Server) AddMyPasswordless(ctx context.Context, _ *empty.Empty) (_ *auth.WebAuthNResponse, err error) {
u2f, err := s.repo.AddMyPasswordless(ctx) u2f, err := s.repo.AddMyPasswordless(ctx)
if err != nil {
return nil, err
}
return verifyWebAuthNFromModel(u2f), err return verifyWebAuthNFromModel(u2f), err
} }

View File

@ -17,11 +17,12 @@ type WebAuthNToken struct {
Challenge string `json:"challenge"` Challenge string `json:"challenge"`
State int32 `json:"-"` State int32 `json:"-"`
KeyID []byte `json:"keyId"` KeyID []byte `json:"keyId"`
PublicKey []byte `json:"publicKey"` PublicKey []byte `json:"publicKey"`
AttestationType string `json:"attestationType"` AttestationType string `json:"attestationType"`
AAGUID []byte `json:"aaguid"` AAGUID []byte `json:"aaguid"`
SignCount uint32 `json:"signCount"` SignCount uint32 `json:"signCount"`
WebAuthNTokenName string `json:"webAuthNTokenName"`
} }
type WebAuthNVerify struct { type WebAuthNVerify struct {
@ -79,29 +80,31 @@ func WebAuthNsFromModel(u2fs []*model.WebAuthNToken) []*WebAuthNToken {
func WebAuthNFromModel(webAuthN *model.WebAuthNToken) *WebAuthNToken { func WebAuthNFromModel(webAuthN *model.WebAuthNToken) *WebAuthNToken {
return &WebAuthNToken{ return &WebAuthNToken{
ObjectRoot: webAuthN.ObjectRoot, ObjectRoot: webAuthN.ObjectRoot,
WebauthNTokenID: webAuthN.WebAuthNTokenID, WebauthNTokenID: webAuthN.WebAuthNTokenID,
Challenge: webAuthN.Challenge, Challenge: webAuthN.Challenge,
State: int32(webAuthN.State), State: int32(webAuthN.State),
KeyID: webAuthN.KeyID, KeyID: webAuthN.KeyID,
PublicKey: webAuthN.PublicKey, PublicKey: webAuthN.PublicKey,
AAGUID: webAuthN.AAGUID, AAGUID: webAuthN.AAGUID,
SignCount: webAuthN.SignCount, SignCount: webAuthN.SignCount,
AttestationType: webAuthN.AttestationType, AttestationType: webAuthN.AttestationType,
WebAuthNTokenName: webAuthN.WebAuthNTokenName,
} }
} }
func WebAuthNToModel(webAuthN *WebAuthNToken) *model.WebAuthNToken { func WebAuthNToModel(webAuthN *WebAuthNToken) *model.WebAuthNToken {
return &model.WebAuthNToken{ return &model.WebAuthNToken{
ObjectRoot: webAuthN.ObjectRoot, ObjectRoot: webAuthN.ObjectRoot,
WebAuthNTokenID: webAuthN.WebauthNTokenID, WebAuthNTokenID: webAuthN.WebauthNTokenID,
Challenge: webAuthN.Challenge, Challenge: webAuthN.Challenge,
State: model.MFAState(webAuthN.State), State: model.MFAState(webAuthN.State),
KeyID: webAuthN.KeyID, KeyID: webAuthN.KeyID,
PublicKey: webAuthN.PublicKey, PublicKey: webAuthN.PublicKey,
AAGUID: webAuthN.AAGUID, AAGUID: webAuthN.AAGUID,
SignCount: webAuthN.SignCount, SignCount: webAuthN.SignCount,
AttestationType: webAuthN.AttestationType, AttestationType: webAuthN.AttestationType,
WebAuthNTokenName: webAuthN.WebAuthNTokenName,
} }
} }

View File

@ -374,7 +374,7 @@ func (u *UserView) addPasswordlessToken(event *models.Event) error {
} }
} }
token.State = int32(model.MFAStateNotReady) token.State = int32(model.MFAStateNotReady)
u.U2FTokens = append(u.U2FTokens, token) u.PasswordlessTokens = append(u.PasswordlessTokens, token)
return nil return nil
} }