@@ -459,11 +459,10 @@ func TestDefaultCredentials_ServiceAccountKeySelfSigned_UniverseDomain(t *testin
459459 now = func () time.Time { return time .Date (2000 , 2 , 1 , 12 , 30 , 0 , 0 , time .UTC ) }
460460 defer func () { now = oldNow }()
461461 wantTok := "eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCIsImtpZCI6ImFiY2RlZjEyMzQ1Njc4OTAifQ.eyJpc3MiOiJnb3BoZXJAZmFrZV9wcm9qZWN0LmlhbS5nc2VydmljZWFjY291bnQuY29tIiwic2NvcGUiOiJodHRwczovL3d3dy5nb29nbGVhcGlzLmNvbS9hdXRoL2Nsb3VkLXBsYXRmb3JtIiwiZXhwIjo5NDk0MTE4MDAsImlhdCI6OTQ5NDA4MjAwLCJhdWQiOiIiLCJzdWIiOiJnb3BoZXJAZmFrZV9wcm9qZWN0LmlhbS5nc2VydmljZWFjY291bnQuY29tIn0.n9Hggd-1Vw4WTQiWkh7q9r5eDsz-khU5vwkZl2VmgdUF3ZxDq1ARzchCNtTifeorzbp9C0i0vCr855G7FZkVCJXPVMcnxbwfMSafUYmVsmutbQiV9eTWfWM0_Ljiwa9GEbv1bN06Lz4LrelPKEaxsDbY6tU8LJUiome_gSMLfLk"
462-
463462 creds , err := DetectDefault (& DetectOptions {
464- CredentialsJSON : b ,
465- Scopes : []string {"https://www.googleapis.com/auth/cloud-platform" },
466- UseSelfSignedJWT : true ,
463+ // default scopes are set in resolveDetectOptions before calling DetectDefault.
464+ Scopes : []string {"https://www.googleapis.com/auth/cloud-platform" },
465+ CredentialsJSON : b ,
467466 })
468467 if err != nil {
469468 t .Fatal (err )
@@ -805,26 +804,29 @@ func TestDefaultCredentials_UniverseDomain(t *testing.T) {
805804 {
806805 name : "service account json with file universe domain" ,
807806 opts : & DetectOptions {
808- CredentialsFile : "../internal/testdata/sa_universe_domain.json" ,
809- UseSelfSignedJWT : true ,
807+ CredentialsFile : "../internal/testdata/sa_universe_domain.json" ,
808+ // default scopes are set in resolveDetectOptions before calling DetectDefault.
809+ Scopes : []string {"https://www.googleapis.com/auth/cloud-platform" },
810810 },
811811 want : "example.com" ,
812812 },
813813 {
814814 name : "service account json with options universe domain" ,
815815 opts : & DetectOptions {
816- CredentialsFile : "../internal/testdata/sa.json" ,
817- UseSelfSignedJWT : true ,
818- UniverseDomain : "foo.com" ,
816+ CredentialsFile : "../internal/testdata/sa.json" ,
817+ // default scopes are set in resolveDetectOptions before calling DetectDefault.
818+ Scopes : []string {"https://www.googleapis.com/auth/cloud-platform" },
819+ UniverseDomain : "foo.com" ,
819820 },
820821 want : "foo.com" ,
821822 },
822823 {
823824 name : "service account json with file and options universe domain" ,
824825 opts : & DetectOptions {
825- CredentialsFile : "../internal/testdata/sa_universe_domain.json" ,
826- UseSelfSignedJWT : true ,
827- UniverseDomain : "foo.com" ,
826+ CredentialsFile : "../internal/testdata/sa_universe_domain.json" ,
827+ // default scopes are set in resolveDetectOptions before calling DetectDefault.
828+ Scopes : []string {"https://www.googleapis.com/auth/cloud-platform" },
829+ UniverseDomain : "foo.com" ,
828830 },
829831 want : "foo.com" ,
830832 },
@@ -923,8 +925,9 @@ func TestDefaultCredentials_UniverseDomain(t *testing.T) {
923925 {
924926 name : "impersonated service account json" ,
925927 opts : & DetectOptions {
926- CredentialsFile : "../internal/testdata/imp.json" ,
927- UseSelfSignedJWT : true ,
928+ CredentialsFile : "../internal/testdata/imp.json" ,
929+ // default scopes are set in resolveDetectOptions before calling DetectDefault.
930+ Scopes : []string {"https://www.googleapis.com/auth/cloud-platform" },
928931 },
929932 want : "googleapis.com" ,
930933 },
@@ -938,17 +941,20 @@ func TestDefaultCredentials_UniverseDomain(t *testing.T) {
938941 {
939942 name : "impersonated service account json with options universe domain" ,
940943 opts : & DetectOptions {
941- CredentialsFile : "../internal/testdata/imp.json" ,
942- UseSelfSignedJWT : true ,
943- UniverseDomain : "foo.com" ,
944+ CredentialsFile : "../internal/testdata/imp.json" ,
945+ // default scopes are set in resolveDetectOptions before calling DetectDefault.
946+ Scopes : []string {"https://www.googleapis.com/auth/cloud-platform" },
947+ UniverseDomain : "foo.com" ,
944948 },
945949 want : "foo.com" ,
946950 },
947951 {
948952 name : "impersonated service account json with file and options universe domain" ,
949953 opts : & DetectOptions {
950954 CredentialsFile : "../internal/testdata/imp_universe_domain.json" ,
951- UniverseDomain : "foo.com" ,
955+ // default scopes are set in resolveDetectOptions before calling DetectDefault.
956+ Scopes : []string {"https://www.googleapis.com/auth/cloud-platform" },
957+ UniverseDomain : "foo.com" ,
952958 },
953959 want : "foo.com" ,
954960 },
0 commit comments