4
0

authority_test.go 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589
  1. package authority
  2. import (
  3. "context"
  4. "crypto"
  5. "crypto/rand"
  6. "crypto/sha256"
  7. "crypto/x509"
  8. "encoding/hex"
  9. "encoding/pem"
  10. "net"
  11. "os"
  12. "path/filepath"
  13. "reflect"
  14. "testing"
  15. "time"
  16. "github.com/pkg/errors"
  17. "github.com/smallstep/assert"
  18. "github.com/smallstep/certificates/authority/config"
  19. "github.com/smallstep/certificates/authority/provisioner"
  20. "github.com/smallstep/certificates/db"
  21. "go.step.sm/crypto/jose"
  22. "go.step.sm/crypto/minica"
  23. "go.step.sm/crypto/pemutil"
  24. )
  25. func testAuthority(t *testing.T, opts ...Option) *Authority {
  26. maxjwk, err := jose.ReadKey("testdata/secrets/max_pub.jwk")
  27. assert.FatalError(t, err)
  28. clijwk, err := jose.ReadKey("testdata/secrets/step_cli_key_pub.jwk")
  29. assert.FatalError(t, err)
  30. disableRenewal := true
  31. enableSSHCA := true
  32. p := provisioner.List{
  33. &provisioner.JWK{
  34. Name: "Max",
  35. Type: "JWK",
  36. Key: maxjwk,
  37. },
  38. &provisioner.JWK{
  39. Name: "step-cli",
  40. Type: "JWK",
  41. Key: clijwk,
  42. Claims: &provisioner.Claims{
  43. EnableSSHCA: &enableSSHCA,
  44. },
  45. },
  46. &provisioner.JWK{
  47. Name: "dev",
  48. Type: "JWK",
  49. Key: maxjwk,
  50. Claims: &provisioner.Claims{
  51. DisableRenewal: &disableRenewal,
  52. },
  53. },
  54. &provisioner.JWK{
  55. Name: "renew_disabled",
  56. Type: "JWK",
  57. Key: maxjwk,
  58. Claims: &provisioner.Claims{
  59. DisableRenewal: &disableRenewal,
  60. },
  61. },
  62. &provisioner.SSHPOP{
  63. Name: "sshpop",
  64. Type: "SSHPOP",
  65. Claims: &provisioner.Claims{
  66. EnableSSHCA: &enableSSHCA,
  67. },
  68. },
  69. &provisioner.JWK{
  70. Name: "uninitialized",
  71. Type: "JWK",
  72. Key: clijwk,
  73. Claims: &provisioner.Claims{
  74. MinTLSDur: &provisioner.Duration{Duration: 5 * time.Minute},
  75. MaxTLSDur: &provisioner.Duration{Duration: time.Minute},
  76. },
  77. },
  78. }
  79. c := &Config{
  80. Address: "127.0.0.1:443",
  81. Root: []string{"testdata/certs/root_ca.crt"},
  82. IntermediateCert: "testdata/certs/intermediate_ca.crt",
  83. IntermediateKey: "testdata/secrets/intermediate_ca_key",
  84. SSH: &SSHConfig{
  85. HostKey: "testdata/secrets/ssh_host_ca_key",
  86. UserKey: "testdata/secrets/ssh_user_ca_key",
  87. },
  88. DNSNames: []string{"example.com"},
  89. Password: "pass",
  90. AuthorityConfig: &AuthConfig{
  91. Provisioners: p,
  92. },
  93. }
  94. a, err := New(c, opts...)
  95. assert.FatalError(t, err)
  96. // Avoid errors when test tokens are created before the test authority. This
  97. // happens in some tests where we re-create the same authority to test
  98. // special cases without re-creating the token.
  99. a.startTime = a.startTime.Add(-1 * time.Minute)
  100. return a
  101. }
  102. func TestAuthorityNew(t *testing.T) {
  103. type newTest struct {
  104. config *Config
  105. err error
  106. }
  107. tests := map[string]func(t *testing.T) *newTest{
  108. "ok": func(t *testing.T) *newTest {
  109. c, err := LoadConfiguration("../ca/testdata/ca.json")
  110. assert.FatalError(t, err)
  111. return &newTest{
  112. config: c,
  113. }
  114. },
  115. "fail bad root": func(t *testing.T) *newTest {
  116. c, err := LoadConfiguration("../ca/testdata/ca.json")
  117. assert.FatalError(t, err)
  118. c.Root = []string{"foo"}
  119. return &newTest{
  120. config: c,
  121. err: errors.New(`error reading "foo": no such file or directory`),
  122. }
  123. },
  124. "fail bad password": func(t *testing.T) *newTest {
  125. c, err := LoadConfiguration("../ca/testdata/ca.json")
  126. assert.FatalError(t, err)
  127. c.Password = "wrong"
  128. return &newTest{
  129. config: c,
  130. err: errors.New("error decrypting ../ca/testdata/secrets/intermediate_ca_key: x509: decryption password incorrect"),
  131. }
  132. },
  133. "fail loading CA cert": func(t *testing.T) *newTest {
  134. c, err := LoadConfiguration("../ca/testdata/ca.json")
  135. assert.FatalError(t, err)
  136. c.IntermediateCert = "wrong"
  137. return &newTest{
  138. config: c,
  139. err: errors.New(`error reading "wrong": no such file or directory`),
  140. }
  141. },
  142. }
  143. for name, genTestCase := range tests {
  144. t.Run(name, func(t *testing.T) {
  145. tc := genTestCase(t)
  146. auth, err := New(tc.config)
  147. if err != nil {
  148. if assert.NotNil(t, tc.err) {
  149. assert.HasPrefix(t, err.Error(), tc.err.Error())
  150. }
  151. } else {
  152. if assert.Nil(t, tc.err) {
  153. sum := sha256.Sum256(auth.rootX509Certs[0].Raw)
  154. root, ok := auth.certificates.Load(hex.EncodeToString(sum[:]))
  155. assert.Fatal(t, ok)
  156. assert.Equals(t, auth.rootX509Certs[0], root)
  157. assert.True(t, auth.initOnce)
  158. assert.NotNil(t, auth.x509CAService)
  159. for _, p := range tc.config.AuthorityConfig.Provisioners {
  160. var _p provisioner.Interface
  161. _p, ok = auth.provisioners.Load(p.GetID())
  162. assert.True(t, ok)
  163. assert.Equals(t, p, _p)
  164. var kid, encryptedKey string
  165. if kid, encryptedKey, ok = p.GetEncryptedKey(); ok {
  166. var key string
  167. key, ok = auth.provisioners.LoadEncryptedKey(kid)
  168. assert.True(t, ok)
  169. assert.Equals(t, encryptedKey, key)
  170. }
  171. }
  172. // sanity check
  173. _, ok = auth.provisioners.Load("fooo")
  174. assert.False(t, ok)
  175. }
  176. }
  177. })
  178. }
  179. }
  180. func TestAuthorityNew_bundles(t *testing.T) {
  181. ca0, err := minica.New()
  182. if err != nil {
  183. t.Fatal(err)
  184. }
  185. ca1, err := minica.New()
  186. if err != nil {
  187. t.Fatal(err)
  188. }
  189. ca2, err := minica.New()
  190. if err != nil {
  191. t.Fatal(err)
  192. }
  193. rootPath := t.TempDir()
  194. writeCert := func(fn string, certs ...*x509.Certificate) error {
  195. var b []byte
  196. for _, crt := range certs {
  197. b = append(b, pem.EncodeToMemory(&pem.Block{
  198. Type: "CERTIFICATE",
  199. Bytes: crt.Raw,
  200. })...)
  201. }
  202. return os.WriteFile(filepath.Join(rootPath, fn), b, 0600)
  203. }
  204. writeKey := func(fn string, signer crypto.Signer) error {
  205. _, err := pemutil.Serialize(signer, pemutil.ToFile(filepath.Join(rootPath, fn), 0600))
  206. return err
  207. }
  208. if err := writeCert("root0.crt", ca0.Root); err != nil {
  209. t.Fatal(err)
  210. }
  211. if err := writeCert("int0.crt", ca0.Intermediate); err != nil {
  212. t.Fatal(err)
  213. }
  214. if err := writeKey("int0.key", ca0.Signer); err != nil {
  215. t.Fatal(err)
  216. }
  217. if err := writeCert("root1.crt", ca1.Root); err != nil {
  218. t.Fatal(err)
  219. }
  220. if err := writeCert("int1.crt", ca1.Intermediate); err != nil {
  221. t.Fatal(err)
  222. }
  223. if err := writeKey("int1.key", ca1.Signer); err != nil {
  224. t.Fatal(err)
  225. }
  226. if err := writeCert("bundle0.crt", ca0.Root, ca1.Root); err != nil {
  227. t.Fatal(err)
  228. }
  229. if err := writeCert("bundle1.crt", ca1.Root, ca2.Root); err != nil {
  230. t.Fatal(err)
  231. }
  232. tests := []struct {
  233. name string
  234. config *config.Config
  235. wantErr bool
  236. }{
  237. {"ok ca0", &config.Config{
  238. Address: "127.0.0.1:443",
  239. Root: []string{filepath.Join(rootPath, "root0.crt")},
  240. IntermediateCert: filepath.Join(rootPath, "int0.crt"),
  241. IntermediateKey: filepath.Join(rootPath, "int0.key"),
  242. DNSNames: []string{"127.0.0.1"},
  243. AuthorityConfig: &AuthConfig{},
  244. }, false},
  245. {"ok bundle", &config.Config{
  246. Address: "127.0.0.1:443",
  247. Root: []string{filepath.Join(rootPath, "bundle0.crt")},
  248. IntermediateCert: filepath.Join(rootPath, "int0.crt"),
  249. IntermediateKey: filepath.Join(rootPath, "int0.key"),
  250. DNSNames: []string{"127.0.0.1"},
  251. AuthorityConfig: &AuthConfig{},
  252. }, false},
  253. {"ok federated ca1", &config.Config{
  254. Address: "127.0.0.1:443",
  255. Root: []string{filepath.Join(rootPath, "root0.crt")},
  256. FederatedRoots: []string{filepath.Join(rootPath, "root1.crt")},
  257. IntermediateCert: filepath.Join(rootPath, "int0.crt"),
  258. IntermediateKey: filepath.Join(rootPath, "int0.key"),
  259. DNSNames: []string{"127.0.0.1"},
  260. AuthorityConfig: &AuthConfig{},
  261. }, false},
  262. {"ok federated bundle", &config.Config{
  263. Address: "127.0.0.1:443",
  264. Root: []string{filepath.Join(rootPath, "root0.crt")},
  265. FederatedRoots: []string{filepath.Join(rootPath, "bundle1.crt")},
  266. IntermediateCert: filepath.Join(rootPath, "int0.crt"),
  267. IntermediateKey: filepath.Join(rootPath, "int0.key"),
  268. DNSNames: []string{"127.0.0.1"},
  269. AuthorityConfig: &AuthConfig{},
  270. }, false},
  271. {"fail root", &config.Config{
  272. Address: "127.0.0.1:443",
  273. Root: []string{filepath.Join(rootPath, "missing.crt")},
  274. IntermediateCert: filepath.Join(rootPath, "int0.crt"),
  275. IntermediateKey: filepath.Join(rootPath, "int0.key"),
  276. DNSNames: []string{"127.0.0.1"},
  277. AuthorityConfig: &AuthConfig{},
  278. }, true},
  279. {"fail federated", &config.Config{
  280. Address: "127.0.0.1:443",
  281. Root: []string{filepath.Join(rootPath, "root0.crt")},
  282. FederatedRoots: []string{filepath.Join(rootPath, "missing.crt")},
  283. IntermediateCert: filepath.Join(rootPath, "int0.crt"),
  284. IntermediateKey: filepath.Join(rootPath, "int0.key"),
  285. DNSNames: []string{"127.0.0.1"},
  286. AuthorityConfig: &AuthConfig{},
  287. }, true},
  288. }
  289. for _, tt := range tests {
  290. t.Run(tt.name, func(t *testing.T) {
  291. _, err := New(tt.config)
  292. if (err != nil) != tt.wantErr {
  293. t.Errorf("New() error = %v, wantErr %v", err, tt.wantErr)
  294. return
  295. }
  296. })
  297. }
  298. }
  299. func TestAuthority_GetDatabase(t *testing.T) {
  300. auth := testAuthority(t)
  301. authWithDatabase, err := New(auth.config, WithDatabase(auth.db))
  302. assert.FatalError(t, err)
  303. tests := []struct {
  304. name string
  305. auth *Authority
  306. want db.AuthDB
  307. }{
  308. {"ok", auth, auth.db},
  309. {"ok WithDatabase", authWithDatabase, auth.db},
  310. }
  311. for _, tt := range tests {
  312. t.Run(tt.name, func(t *testing.T) {
  313. if got := tt.auth.GetDatabase(); !reflect.DeepEqual(got, tt.want) {
  314. t.Errorf("Authority.GetDatabase() = %v, want %v", got, tt.want)
  315. }
  316. })
  317. }
  318. }
  319. func TestNewEmbedded(t *testing.T) {
  320. caPEM, err := os.ReadFile("testdata/certs/root_ca.crt")
  321. assert.FatalError(t, err)
  322. crt, err := pemutil.ReadCertificate("testdata/certs/intermediate_ca.crt")
  323. assert.FatalError(t, err)
  324. key, err := pemutil.Read("testdata/secrets/intermediate_ca_key", pemutil.WithPassword([]byte("pass")))
  325. assert.FatalError(t, err)
  326. type args struct {
  327. opts []Option
  328. }
  329. tests := []struct {
  330. name string
  331. args args
  332. wantErr bool
  333. }{
  334. {"ok", args{[]Option{WithX509RootBundle(caPEM), WithX509Signer(crt, key.(crypto.Signer))}}, false},
  335. {"ok empty config", args{[]Option{WithConfig(&Config{}), WithX509RootBundle(caPEM), WithX509Signer(crt, key.(crypto.Signer))}}, false},
  336. {"ok config file", args{[]Option{WithConfigFile("../ca/testdata/ca.json")}}, false},
  337. {"ok config", args{[]Option{WithConfig(&Config{
  338. Root: []string{"testdata/certs/root_ca.crt"},
  339. IntermediateCert: "testdata/certs/intermediate_ca.crt",
  340. IntermediateKey: "testdata/secrets/intermediate_ca_key",
  341. Password: "pass",
  342. AuthorityConfig: &AuthConfig{},
  343. })}}, false},
  344. {"fail options", args{[]Option{WithX509RootBundle([]byte("bad data"))}}, true},
  345. {"fail missing config", args{[]Option{WithConfig(nil), WithX509RootBundle(caPEM), WithX509Signer(crt, key.(crypto.Signer))}}, true},
  346. {"fail missing root", args{[]Option{WithX509Signer(crt, key.(crypto.Signer))}}, true},
  347. {"fail missing signer", args{[]Option{WithX509RootBundle(caPEM)}}, true},
  348. {"fail missing root file", args{[]Option{WithConfig(&Config{
  349. IntermediateCert: "testdata/certs/intermediate_ca.crt",
  350. IntermediateKey: "testdata/secrets/intermediate_ca_key",
  351. Password: "pass",
  352. AuthorityConfig: &AuthConfig{},
  353. })}}, true},
  354. {"fail missing issuer", args{[]Option{WithConfig(&Config{
  355. Root: []string{"testdata/certs/root_ca.crt"},
  356. IntermediateKey: "testdata/secrets/intermediate_ca_key",
  357. Password: "pass",
  358. AuthorityConfig: &AuthConfig{},
  359. })}}, true},
  360. {"fail missing signer", args{[]Option{WithConfig(&Config{
  361. Root: []string{"testdata/certs/root_ca.crt"},
  362. IntermediateCert: "testdata/certs/intermediate_ca.crt",
  363. Password: "pass",
  364. AuthorityConfig: &AuthConfig{},
  365. })}}, true},
  366. {"fail bad password", args{[]Option{WithConfig(&Config{
  367. Root: []string{"testdata/certs/root_ca.crt"},
  368. IntermediateCert: "testdata/certs/intermediate_ca.crt",
  369. IntermediateKey: "testdata/secrets/intermediate_ca_key",
  370. Password: "bad",
  371. AuthorityConfig: &AuthConfig{},
  372. })}}, true},
  373. }
  374. for _, tt := range tests {
  375. t.Run(tt.name, func(t *testing.T) {
  376. got, err := NewEmbedded(tt.args.opts...)
  377. if (err != nil) != tt.wantErr {
  378. t.Errorf("NewEmbedded() error = %v, wantErr %v", err, tt.wantErr)
  379. return
  380. }
  381. if err == nil {
  382. assert.True(t, got.initOnce)
  383. assert.NotNil(t, got.rootX509Certs)
  384. assert.NotNil(t, got.x509CAService)
  385. }
  386. })
  387. }
  388. }
  389. func TestNewEmbedded_Sign(t *testing.T) {
  390. caPEM, err := os.ReadFile("testdata/certs/root_ca.crt")
  391. assert.FatalError(t, err)
  392. crt, err := pemutil.ReadCertificate("testdata/certs/intermediate_ca.crt")
  393. assert.FatalError(t, err)
  394. key, err := pemutil.Read("testdata/secrets/intermediate_ca_key", pemutil.WithPassword([]byte("pass")))
  395. assert.FatalError(t, err)
  396. a, err := NewEmbedded(WithX509RootBundle(caPEM), WithX509Signer(crt, key.(crypto.Signer)))
  397. assert.FatalError(t, err)
  398. // Sign
  399. cr, err := x509.CreateCertificateRequest(rand.Reader, &x509.CertificateRequest{
  400. DNSNames: []string{"foo.bar.zar"},
  401. }, key)
  402. assert.FatalError(t, err)
  403. csr, err := x509.ParseCertificateRequest(cr)
  404. assert.FatalError(t, err)
  405. cert, err := a.SignWithContext(context.Background(), csr, provisioner.SignOptions{})
  406. assert.FatalError(t, err)
  407. assert.Equals(t, []string{"foo.bar.zar"}, cert[0].DNSNames)
  408. assert.Equals(t, crt, cert[1])
  409. }
  410. func TestNewEmbedded_GetTLSCertificate(t *testing.T) {
  411. caPEM, err := os.ReadFile("testdata/certs/root_ca.crt")
  412. assert.FatalError(t, err)
  413. crt, err := pemutil.ReadCertificate("testdata/certs/intermediate_ca.crt")
  414. assert.FatalError(t, err)
  415. key, err := pemutil.Read("testdata/secrets/intermediate_ca_key", pemutil.WithPassword([]byte("pass")))
  416. assert.FatalError(t, err)
  417. a, err := NewEmbedded(WithX509RootBundle(caPEM), WithX509Signer(crt, key.(crypto.Signer)))
  418. assert.FatalError(t, err)
  419. // GetTLSCertificate
  420. cert, err := a.GetTLSCertificate()
  421. assert.FatalError(t, err)
  422. assert.Equals(t, []string{"localhost"}, cert.Leaf.DNSNames)
  423. assert.True(t, cert.Leaf.IPAddresses[0].Equal(net.ParseIP("127.0.0.1")))
  424. assert.True(t, cert.Leaf.IPAddresses[1].Equal(net.ParseIP("::1")))
  425. }
  426. func TestAuthority_CloseForReload(t *testing.T) {
  427. tests := []struct {
  428. name string
  429. auth *Authority
  430. }{
  431. {"ok", testAuthority(t)},
  432. }
  433. for _, tt := range tests {
  434. t.Run(tt.name, func(t *testing.T) {
  435. tt.auth.CloseForReload()
  436. })
  437. }
  438. }
  439. func testScepAuthority(t *testing.T, opts ...Option) *Authority {
  440. p := provisioner.List{
  441. &provisioner.SCEP{
  442. Name: "scep1",
  443. Type: "SCEP",
  444. },
  445. }
  446. c := &Config{
  447. Address: "127.0.0.1:8443",
  448. InsecureAddress: "127.0.0.1:8080",
  449. Root: []string{"testdata/scep/root.crt"},
  450. IntermediateCert: "testdata/scep/intermediate.crt",
  451. IntermediateKey: "testdata/scep/intermediate.key",
  452. DNSNames: []string{"example.com"},
  453. Password: "pass",
  454. AuthorityConfig: &AuthConfig{
  455. Provisioners: p,
  456. },
  457. }
  458. a, err := New(c, opts...)
  459. assert.FatalError(t, err)
  460. return a
  461. }
  462. func TestAuthority_GetSCEP(t *testing.T) {
  463. _ = testScepAuthority(t)
  464. p := provisioner.List{
  465. &provisioner.SCEP{
  466. Name: "scep1",
  467. Type: "SCEP",
  468. },
  469. }
  470. type fields struct {
  471. config *Config
  472. }
  473. tests := []struct {
  474. name string
  475. fields fields
  476. wantService bool
  477. wantErr bool
  478. }{
  479. {
  480. name: "ok",
  481. fields: fields{
  482. config: &Config{
  483. Address: "127.0.0.1:8443",
  484. InsecureAddress: "127.0.0.1:8080",
  485. Root: []string{"testdata/scep/root.crt"},
  486. IntermediateCert: "testdata/scep/intermediate.crt",
  487. IntermediateKey: "testdata/scep/intermediate.key",
  488. DNSNames: []string{"example.com"},
  489. Password: "pass",
  490. AuthorityConfig: &AuthConfig{
  491. Provisioners: p,
  492. },
  493. },
  494. },
  495. wantService: true,
  496. wantErr: false,
  497. },
  498. {
  499. name: "wrong password",
  500. fields: fields{
  501. config: &Config{
  502. Address: "127.0.0.1:8443",
  503. InsecureAddress: "127.0.0.1:8080",
  504. Root: []string{"testdata/scep/root.crt"},
  505. IntermediateCert: "testdata/scep/intermediate.crt",
  506. IntermediateKey: "testdata/scep/intermediate.key",
  507. DNSNames: []string{"example.com"},
  508. Password: "wrongpass",
  509. AuthorityConfig: &AuthConfig{
  510. Provisioners: p,
  511. },
  512. },
  513. },
  514. wantService: false,
  515. wantErr: true,
  516. },
  517. }
  518. for _, tt := range tests {
  519. t.Run(tt.name, func(t *testing.T) {
  520. a, err := New(tt.fields.config)
  521. if (err != nil) != tt.wantErr {
  522. t.Errorf("Authority.New(), error = %v, wantErr %v", err, tt.wantErr)
  523. return
  524. }
  525. if tt.wantService {
  526. if got := a.GetSCEP(); (got != nil) != tt.wantService {
  527. t.Errorf("Authority.GetSCEPService() = %v, wantService %v", got, tt.wantService)
  528. }
  529. }
  530. })
  531. }
  532. }
  533. func TestAuthority_GetID(t *testing.T) {
  534. type fields struct {
  535. authorityID string
  536. }
  537. tests := []struct {
  538. name string
  539. fields fields
  540. want string
  541. }{
  542. {"ok", fields{""}, "00000000-0000-0000-0000-000000000000"},
  543. {"ok with id", fields{"10b9a431-ed3b-4a5f-abee-ec35119b65e7"}, "10b9a431-ed3b-4a5f-abee-ec35119b65e7"},
  544. }
  545. for _, tt := range tests {
  546. t.Run(tt.name, func(t *testing.T) {
  547. a := &Authority{
  548. config: &config.Config{
  549. AuthorityConfig: &config.AuthConfig{
  550. AuthorityID: tt.fields.authorityID,
  551. },
  552. },
  553. }
  554. if got := a.GetID(); got != tt.want {
  555. t.Errorf("Authority.GetID() = %v, want %v", got, tt.want)
  556. }
  557. })
  558. }
  559. }