support for new Challenge token for U2F

This commit is contained in:
Kyle Spearrin 2018-10-10 17:52:08 -04:00
parent 9cd0bd5f7c
commit 90f723316a
1 changed files with 17 additions and 12 deletions

View File

@ -97,18 +97,23 @@ export class TwoFactorComponent implements OnInit, OnDestroy {
break; break;
} }
const challenges = JSON.parse(params.Challenges); if (params.Challenge != null) {
if (challenges != null && challenges.length > 0) { this.u2f.init(JSON.parse(params.Challenge));
this.u2f.init({ } else {
appId: challenges[0].appId, // TODO: Deprecated. Remove in future version.
challenge: challenges[0].challenge, const challenges = JSON.parse(params.Challenges);
keys: challenges.map((c: any) => { if (challenges != null && challenges.length > 0) {
return { this.u2f.init({
version: c.version, appId: challenges[0].appId,
keyHandle: c.keyHandle, challenge: challenges[0].challenge,
}; keys: challenges.map((c: any) => {
}), return {
}); version: c.version,
keyHandle: c.keyHandle,
};
}),
});
}
} }
break; break;
case TwoFactorProviderType.Duo: case TwoFactorProviderType.Duo: