Assert something about the returned userinfo
This commit is contained in:
		| @@ -203,10 +203,13 @@ func TestOAuth2CodeFlow(t *testing.T) { | |||||||
| 		{ | 		{ | ||||||
| 			name: "fetch userinfo", | 			name: "fetch userinfo", | ||||||
| 			handleToken: func(ctx context.Context, p *oidc.Provider, config *oauth2.Config, token *oauth2.Token) error { | 			handleToken: func(ctx context.Context, p *oidc.Provider, config *oauth2.Config, token *oauth2.Token) error { | ||||||
| 				_, err := p.UserInfo(ctx, config.TokenSource(ctx, token)) | 				ui, err := p.UserInfo(ctx, config.TokenSource(ctx, token)) | ||||||
| 				if err != nil { | 				if err != nil { | ||||||
| 					return fmt.Errorf("failed to fetch userinfo: %v", err) | 					return fmt.Errorf("failed to fetch userinfo: %v", err) | ||||||
| 				} | 				} | ||||||
|  | 				if conn.Identity.Email != ui.Email { | ||||||
|  | 					return fmt.Errorf("expected email to be %v, got %v", conn.Identity.Email, ui.Email) | ||||||
|  | 				} | ||||||
| 				return nil | 				return nil | ||||||
| 			}, | 			}, | ||||||
| 		}, | 		}, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user