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
6 changed files with 40 additions and 31 deletions

View File

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