Commit 80f179d7 authored by ale's avatar ale
Browse files

Add test to verify u2fRegistration deserialization

parent 2838d93e
Pipeline #24761 canceled with stages
in 10 minutes and 47 seconds
package ldapbackend
import (
"bytes"
"context"
"fmt"
"testing"
......@@ -143,6 +144,24 @@ func TestModel_GetUser_Has2FA(t *testing.T) {
}
}
func TestModel_GetUser_HasU2FRegistrations(t *testing.T) {
stop, _, user := startServerAndGetUser4(t)
defer stop()
if n := len(user.U2FRegistrations); n != 2 {
t.Errorf("user %s has %d u2f registrations, expected 2", user.Name, n)
}
expectedKey := []byte{
164, 1, 2, 3, 38, 33, 88, 32, 182, 233, 26, 63, 41, 208, 70, 136, 89, 102, 192, 232, 56, 134, 225, 180, 18,
196, 51, 198, 91, 162, 121, 83, 86, 85, 224, 46, 64, 151, 99, 8, 34, 88, 32, 34, 176, 200, 116, 202, 44, 231,
42, 170, 189, 102, 70, 10, 9, 116, 206, 125, 3, 130, 59, 200, 44, 245, 249, 90, 172, 181, 184, 201, 81, 174, 182,
}
if !bytes.Equal(user.U2FRegistrations[0].PublicKey, expectedKey) {
t.Errorf("user %s has wrong public key for u2f registration: %v", user.Name, user.U2FRegistrations[0].PublicKey)
}
}
func TestModel_GetUser_Resources(t *testing.T) {
stop, b, user := startServerAndGetUser(t)
defer stop()
......
......@@ -19,6 +19,8 @@ sn: quattro@investici.org
uid: quattro@investici.org
uidNumber: 23801
userPassword:: JGEyJDQkMzI3NjgkMSQwZDgyMzU1YjQ0Mzg0M2NmZDY4MjU1MzE4ZTVjYTdiZSRmNTQ0ODkxOTFiNWZlYzk2MDRlNWQ2ODZjMDQxZjJkNTFmOTgxOGY4ZTFmM2E4MDYzY2U3ZTEwMTE3OTc2OGI0
u2fRegistration:: BLbpGj8p0EaIWWbA6DiG4bQSxDPGW6J5U1ZV4C5Al2MIIrDIdMos5yqqvWZGCgl0zn0DgjvILPX5Wqy1uMlRrrbuJtcRvBQ9DEZZJmMP5CJAJqdKLG07kezOPeLQRNTjhKnW0Zixqzc8jIlqMX/+no675UeHYXr7VSmKALYekyVk
u2fRegistration:: BCCBvjcPNk4xn7Vi2YbJA8alBwIL7pkIkmtdZJwZ9Bcz4EzyE9As/9x43WwvNzaFHvqiB34hncw6IHq/SQrAq/XpdfSnqSm9tYskcbgWcNwsrXhpjTu9Pi9UyWNZtEG4nFGGFRmuNNpjA5C/P2A9V/DIat17nWE4hndFupMU2kVG
totpSecret: ABCDEF
dn: mail=quattro@investici.org,uid=quattro@investici.org,ou=People,dc=example,dc=com
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment