Browse Source

Revert `oidc_test.go`

Moving the `preferred_username` to a separate PR
Cristian Le 5 năm trước cách đây
mục cha
commit
9e00b82bdf

+ 0 - 5
authority/provisioner/oidc_test.go

@@ -514,8 +514,6 @@ func TestOIDC_AuthorizeSSHSign(t *testing.T) {
 	assert.FatalError(t, err)
 	failGetIdentityToken, err := generateSimpleToken("the-issuer", p5.ClientID, &keys.Keys[0])
 	assert.FatalError(t, err)
-	okPreferredUsername, err := generateOIDCToken("subject", "the-issuer", p1.ClientID, "name@smallstep.com", "lecris", time.Now(), &keys.Keys[0])
-	assert.FatalError(t, err)
 	// Admin email not in domains
 	okAdmin, err := generateOIDCToken("subject", "the-issuer", p3.ClientID, "root@example.com", "", time.Now(), &keys.Keys[0])
 	assert.FatalError(t, err)
@@ -576,9 +574,6 @@ func TestOIDC_AuthorizeSSHSign(t *testing.T) {
 		{"ok-emptyPrincipals-getIdentity", p4, args{okGetIdentityToken, SignSSHOptions{}, pub},
 			&SignSSHOptions{CertType: "user", Principals: []string{"max", "mariano"},
 				ValidAfter: NewTimeDuration(tm), ValidBefore: NewTimeDuration(tm.Add(userDuration))}, http.StatusOK, false, false},
-		{"ok-preferred-username", p1, args{okPreferredUsername, SignSSHOptions{CertType: "user", KeyID: "name@smallstep.com", Principals: []string{"lecris"}}, pub},
-			&SignSSHOptions{CertType: "user", Principals: []string{"lecris", "name", "name@smallstep.com"},
-				ValidAfter: NewTimeDuration(tm), ValidBefore: NewTimeDuration(tm.Add(userDuration))}, http.StatusOK, false, false},
 		{"ok-options", p1, args{t1, SignSSHOptions{CertType: "user", Principals: []string{"name"}}, pub},
 			&SignSSHOptions{CertType: "user", Principals: []string{"name", "name@smallstep.com"},
 				ValidAfter: NewTimeDuration(tm), ValidBefore: NewTimeDuration(tm.Add(userDuration))}, http.StatusOK, false, false},

+ 1 - 1
authority/provisioner/provisioner.go

@@ -346,7 +346,7 @@ func DefaultIdentityFunc(ctx context.Context, p Interface, email string, usernam
 	switch k := p.(type) {
 	case *OIDC:
 		// OIDC principals would be:
-		// 1. Preferred usernames.
+		// ~~1. Preferred usernames.~~ Note: Under discussion, currently disabled
 		// 2. Sanitized local.
 		// 3. Raw local (if different).
 		// 4. Email address.