@@ -423,7 +423,7 @@ func TestErrorInSourceToken(t *testing.T) {
423423 WithTokenEndpoint ("http:trololo" ),
424424 WithGrantType ("grant_type" ),
425425 WithRequestTimeout (time .Second ),
426- WithResource ("res" ),
426+ WithResource ("res" , "res2" ),
427427 WithFixedSubjectToken ("t" , "tt" ),
428428 WithActorToken (& errorTokenSource {}),
429429 WithSourceInfo ("TestErrorInSourceToken" ),
@@ -432,7 +432,7 @@ func TestErrorInSourceToken(t *testing.T) {
432432
433433 // Check that token prints well
434434 formatted := fmt .Sprint (client )
435- require .Equal (t , `OAuth2TokenExchange{Endpoint:"http:trololo",GrantType:grant_type,Resource:res,Audience:[],Scope:[],RequestedTokenType:urn:ietf:params:oauth:token-type:access_token,SubjectToken:FixedTokenSource{Token:"****(CRC-32c: 856A5AA8)",Type:tt},ActorToken:&{},From:"TestErrorInSourceToken"}` , formatted ) //nolint:lll
435+ require .Equal (t , `OAuth2TokenExchange{Endpoint:"http:trololo",GrantType:grant_type,Resource:[ res res2] ,Audience:[],Scope:[],RequestedTokenType:urn:ietf:params:oauth:token-type:access_token,SubjectToken:FixedTokenSource{Token:"****(CRC-32c: 856A5AA8)",Type:tt},ActorToken:&{},From:"TestErrorInSourceToken"}` , formatted ) //nolint:lll
436436
437437 token , err := client .Token (context .Background ())
438438 require .ErrorIs (t , err , errTokenSource )
@@ -442,7 +442,7 @@ func TestErrorInSourceToken(t *testing.T) {
442442 WithTokenEndpoint ("http:trololo" ),
443443 WithGrantType ("grant_type" ),
444444 WithRequestTimeout (time .Second ),
445- WithResource ("res" ),
445+ WithResource ("res" , "res2" ),
446446 WithSubjectToken (& errorTokenSource {}),
447447 )
448448 require .NoError (t , err )
@@ -483,7 +483,7 @@ func TestErrorInHTTPRequest(t *testing.T) {
483483
484484 // check format:
485485 formatted := fmt .Sprint (client )
486- require .Equal (t , `OAuth2TokenExchange{Endpoint:"http://invalid_host:42/exchange",GrantType:urn:ietf:params:oauth:grant-type:token-exchange,Resource:,Audience:[],Scope:[1 2 3],RequestedTokenType:urn:ietf:params:oauth:token-type:access_token,SubjectToken:JWTTokenSource{Method:RS256,KeyID:key_id,Issuer:"test_issuer",Subject:"",Audience:[test_audience],ID:,TokenTTL:1h0m0s},ActorToken:JWTTokenSource{Method:RS256,KeyID:key_id,Issuer:"test_issuer",Subject:"",Audience:[],ID:,TokenTTL:1h0m0s},From:"TestErrorInHTTPRequest"}` , formatted ) //nolint:lll
486+ require .Equal (t , `OAuth2TokenExchange{Endpoint:"http://invalid_host:42/exchange",GrantType:urn:ietf:params:oauth:grant-type:token-exchange,Resource:[] ,Audience:[],Scope:[1 2 3],RequestedTokenType:urn:ietf:params:oauth:token-type:access_token,SubjectToken:JWTTokenSource{Method:RS256,KeyID:key_id,Issuer:"test_issuer",Subject:"",Audience:[test_audience],ID:,TokenTTL:1h0m0s},ActorToken:JWTTokenSource{Method:RS256,KeyID:key_id,Issuer:"test_issuer",Subject:"",Audience:[],ID:,TokenTTL:1h0m0s},From:"TestErrorInHTTPRequest"}` , formatted ) //nolint:lll
487487 }, xtest .StopAfter (15 * time .Second ))
488488}
489489
@@ -780,12 +780,16 @@ func TestParseSettingsFromFile(t *testing.T) {
780780 "token-type": "test-token-type"
781781 }
782782 }` ,
783- ExpectedFormattedCredentials : `OAuth2TokenExchange{Endpoint:"http://localhost:123",GrantType:grant,Resource:tEst,Audience:[],Scope:[],RequestedTokenType:urn:ietf:params:oauth:token-type:access_token,SubjectToken:FixedTokenSource{Token:"****(CRC-32c: 1203ABFA)",Type:test-token-type},From:"TestParseSettingsFromFile"}` , //nolint:lll
783+ ExpectedFormattedCredentials : `OAuth2TokenExchange{Endpoint:"http://localhost:123",GrantType:grant,Resource:[ tEst] ,Audience:[],Scope:[],RequestedTokenType:urn:ietf:params:oauth:token-type:access_token,SubjectToken:FixedTokenSource{Token:"****(CRC-32c: 1203ABFA)",Type:test-token-type},From:"TestParseSettingsFromFile"}` , //nolint:lll
784784 },
785785 {
786786 Cfg : `{
787787 "token-endpoint": "http://localhost:123",
788788 "aud": "test-aud",
789+ "res": [
790+ "r1",
791+ "r2"
792+ ],
789793 "scope": [
790794 "s1",
791795 "s2"
@@ -797,7 +801,7 @@ func TestParseSettingsFromFile(t *testing.T) {
797801 "token-type": "test-token-type"
798802 }
799803 }` ,
800- ExpectedFormattedCredentials : `OAuth2TokenExchange{Endpoint:"http://localhost:123",GrantType:urn:ietf:params:oauth:grant-type:token-exchange,Resource:,Audience:[test-aud],Scope:[s1 s2],RequestedTokenType:urn:ietf:params:oauth:token-type:access_token,ActorToken:FixedTokenSource{Token:"****(CRC-32c: 1203ABFA)",Type:test-token-type},From:"TestParseSettingsFromFile"}` , //nolint:lll
804+ ExpectedFormattedCredentials : `OAuth2TokenExchange{Endpoint:"http://localhost:123",GrantType:urn:ietf:params:oauth:grant-type:token-exchange,Resource:[r1 r2] ,Audience:[test-aud],Scope:[s1 s2],RequestedTokenType:urn:ietf:params:oauth:token-type:access_token,ActorToken:FixedTokenSource{Token:"****(CRC-32c: 1203ABFA)",Type:test-token-type},From:"TestParseSettingsFromFile"}` , //nolint:lll
801805 },
802806 {
803807 Cfg : `{
@@ -816,7 +820,7 @@ func TestParseSettingsFromFile(t *testing.T) {
816820 "unknown_field": [123]
817821 }
818822 }` ,
819- ExpectedFormattedCredentials : `OAuth2TokenExchange{Endpoint:"http://localhost:123",GrantType:urn:ietf:params:oauth:grant-type:token-exchange,Resource:,Audience:[],Scope:[],RequestedTokenType:access_token,SubjectToken:JWTTokenSource{Method:PS256,KeyID:test_key_id,Issuer:"test_issuer",Subject:"test_subject",Audience:[a1 a2],ID:123,TokenTTL:24h0m0s},From:"TestParseSettingsFromFile"}` , //nolint:lll
823+ ExpectedFormattedCredentials : `OAuth2TokenExchange{Endpoint:"http://localhost:123",GrantType:urn:ietf:params:oauth:grant-type:token-exchange,Resource:[] ,Audience:[],Scope:[],RequestedTokenType:access_token,SubjectToken:JWTTokenSource{Method:PS256,KeyID:test_key_id,Issuer:"test_issuer",Subject:"test_subject",Audience:[a1 a2],ID:123,TokenTTL:24h0m0s},From:"TestParseSettingsFromFile"}` , //nolint:lll
820824 },
821825 {
822826 Cfg : `{
@@ -828,7 +832,7 @@ func TestParseSettingsFromFile(t *testing.T) {
828832 "ttl": "3m"
829833 }
830834 }` ,
831- ExpectedFormattedCredentials : `OAuth2TokenExchange{Endpoint:"http://localhost:123",GrantType:urn:ietf:params:oauth:grant-type:token-exchange,Resource:,Audience:[],Scope:[],RequestedTokenType:urn:ietf:params:oauth:token-type:access_token,SubjectToken:JWTTokenSource{Method:ES256,KeyID:,Issuer:"",Subject:"",Audience:[],ID:,TokenTTL:3m0s},From:"TestParseSettingsFromFile"}` , //nolint:lll
835+ ExpectedFormattedCredentials : `OAuth2TokenExchange{Endpoint:"http://localhost:123",GrantType:urn:ietf:params:oauth:grant-type:token-exchange,Resource:[] ,Audience:[],Scope:[],RequestedTokenType:urn:ietf:params:oauth:token-type:access_token,SubjectToken:JWTTokenSource{Method:ES256,KeyID:,Issuer:"",Subject:"",Audience:[],ID:,TokenTTL:3m0s},From:"TestParseSettingsFromFile"}` , //nolint:lll
832836 },
833837 {
834838 Cfg : `{
@@ -839,7 +843,7 @@ func TestParseSettingsFromFile(t *testing.T) {
839843 "private-key": "` + testHMACSecretKeyBase64Content + `"
840844 }
841845 }` ,
842- ExpectedFormattedCredentials : `OAuth2TokenExchange{Endpoint:"http://localhost:123",GrantType:urn:ietf:params:oauth:grant-type:token-exchange,Resource:,Audience:[],Scope:[],RequestedTokenType:urn:ietf:params:oauth:token-type:access_token,SubjectToken:JWTTokenSource{Method:HS512,KeyID:,Issuer:"",Subject:"",Audience:[],ID:,TokenTTL:1h0m0s},From:"TestParseSettingsFromFile"}` , //nolint:lll
846+ ExpectedFormattedCredentials : `OAuth2TokenExchange{Endpoint:"http://localhost:123",GrantType:urn:ietf:params:oauth:grant-type:token-exchange,Resource:[] ,Audience:[],Scope:[],RequestedTokenType:urn:ietf:params:oauth:token-type:access_token,SubjectToken:JWTTokenSource{Method:HS512,KeyID:,Issuer:"",Subject:"",Audience:[],ID:,TokenTTL:1h0m0s},From:"TestParseSettingsFromFile"}` , //nolint:lll
843847 },
844848 {
845849 Cfg : `{
0 commit comments