forked from Mirrors/oauth2
go fmt
Change-Id: Ie9d82a9c162eb72f63ebd75a284083eb4318d6d1
This commit is contained in:
parent
bf1e0506de
commit
3454980053
|
@ -115,14 +115,13 @@ type credentialsFile struct {
|
|||
RefreshToken string `json:"refresh_token"`
|
||||
|
||||
// External Account fields
|
||||
Audience string `json:"audience"`
|
||||
SubjectTokenType string `json:"subject_token_type"`
|
||||
TokenURLExternal string `json:"token_url"`
|
||||
TokenInfoURL string `json:"token_info_url"`
|
||||
ServiceAccountImpersonationURL string `json:"service_account_impersonation_url"`
|
||||
CredentialSource externalaccount.CredentialSource `json:"credential_source"`
|
||||
QuotaProjectID string `json:"quota_project_id"`
|
||||
|
||||
Audience string `json:"audience"`
|
||||
SubjectTokenType string `json:"subject_token_type"`
|
||||
TokenURLExternal string `json:"token_url"`
|
||||
TokenInfoURL string `json:"token_info_url"`
|
||||
ServiceAccountImpersonationURL string `json:"service_account_impersonation_url"`
|
||||
CredentialSource externalaccount.CredentialSource `json:"credential_source"`
|
||||
QuotaProjectID string `json:"quota_project_id"`
|
||||
}
|
||||
|
||||
func (f *credentialsFile) jwtConfig(scopes []string) *jwt.Config {
|
||||
|
@ -155,16 +154,16 @@ func (f *credentialsFile) tokenSource(ctx context.Context, scopes []string) (oau
|
|||
return cfg.TokenSource(ctx, tok), nil
|
||||
case externalAccountKey:
|
||||
cfg := &externalaccount.Config{
|
||||
Audience: f.Audience,
|
||||
SubjectTokenType: f.SubjectTokenType,
|
||||
TokenURL: f.TokenURLExternal,
|
||||
TokenInfoURL: f.TokenInfoURL,
|
||||
Audience: f.Audience,
|
||||
SubjectTokenType: f.SubjectTokenType,
|
||||
TokenURL: f.TokenURLExternal,
|
||||
TokenInfoURL: f.TokenInfoURL,
|
||||
ServiceAccountImpersonationURL: f.ServiceAccountImpersonationURL,
|
||||
ClientSecret: f.ClientSecret,
|
||||
ClientID: f.ClientID,
|
||||
CredentialSource: f.CredentialSource,
|
||||
QuotaProjectID: f.QuotaProjectID,
|
||||
Scopes: scopes,
|
||||
ClientSecret: f.ClientSecret,
|
||||
ClientID: f.ClientID,
|
||||
CredentialSource: f.CredentialSource,
|
||||
QuotaProjectID: f.QuotaProjectID,
|
||||
Scopes: scopes,
|
||||
}
|
||||
return cfg.TokenSource(ctx), nil
|
||||
case "":
|
||||
|
|
|
@ -15,9 +15,9 @@ import (
|
|||
)
|
||||
|
||||
type urlCredentialSource struct {
|
||||
URL string
|
||||
URL string
|
||||
Headers map[string]string
|
||||
Format format
|
||||
Format format
|
||||
}
|
||||
|
||||
func (cs urlCredentialSource) subjectToken() (string, error) {
|
||||
|
|
|
@ -13,8 +13,6 @@ import (
|
|||
|
||||
var myURLToken = "testTokenValue"
|
||||
|
||||
|
||||
|
||||
func TestRetrieveURLSubjectToken_Text(t *testing.T) {
|
||||
|
||||
ts := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
|
@ -24,7 +22,7 @@ func TestRetrieveURLSubjectToken_Text(t *testing.T) {
|
|||
w.Write([]byte("testTokenValue"))
|
||||
}))
|
||||
cs := CredentialSource{
|
||||
URL: ts.URL,
|
||||
URL: ts.URL,
|
||||
Format: format{Type: fileTypeText},
|
||||
}
|
||||
tfc := testFileConfig
|
||||
|
@ -81,7 +79,7 @@ func TestRetrieveURLSubjectToken_JSON(t *testing.T) {
|
|||
w.Write(jsonResp)
|
||||
}))
|
||||
cs := CredentialSource{
|
||||
URL: ts.URL,
|
||||
URL: ts.URL,
|
||||
Format: format{Type: fileTypeJSON, SubjectTokenFieldName: "SubjToken"},
|
||||
}
|
||||
tfc := testFileConfig
|
||||
|
@ -89,7 +87,6 @@ func TestRetrieveURLSubjectToken_JSON(t *testing.T) {
|
|||
|
||||
out, err := tfc.parse().subjectToken()
|
||||
|
||||
|
||||
if err != nil {
|
||||
t.Fatalf("%v", err)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue