Skip to content

Commit

Permalink
oauth2: changed connect time outs from 5 to 60 seconds
Browse files Browse the repository at this point in the history
This should be configurable, for now increase the time out manually.
  • Loading branch information
martinrode committed Jul 9, 2021
1 parent 39c5e73 commit d6e54dc
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions pkg/lib/util/oauth.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ func getOAuthClientCredentialsConfig(c OAuthClientConfig) clientcredentials.Conf
// to get a token on behalf of a user
func (c OAuthClientConfig) GetPasswordCredentialsAuthToken(username string, password string) (*oauth2.Token, error) {
cfg := getOAuthClientConfig(c)
httpClient := &http.Client{Timeout: 5 * time.Second}
httpClient := &http.Client{Timeout: 60 * time.Second}
ctx := context.WithValue(context.Background(), oauth2.HTTPClient, httpClient)
return cfg.PasswordCredentialsToken(ctx, username, password)
}
Expand All @@ -63,7 +63,7 @@ func (c OAuthClientConfig) GetPasswordCredentialsAuthToken(username string, pass
// to get a token on behalf of a user
func (c OAuthClientConfig) GetClientCredentialsAuthToken() (*oauth2.Token, error) {
cfg := getOAuthClientCredentialsConfig(c)
httpClient := &http.Client{Timeout: 5 * time.Second}
httpClient := &http.Client{Timeout: 60 * time.Second}
ctx := context.WithValue(context.Background(), oauth2.HTTPClient, httpClient)
return cfg.Token(ctx)
}
Expand Down Expand Up @@ -104,7 +104,7 @@ func (c OAuthClientConfig) getRedirectURL(params ...string) (*url.URL, error) {
}
}
authURL.RawQuery = cqv.Encode()
httpClient := &http.Client{Timeout: 5 * time.Second}
httpClient := &http.Client{Timeout: 60 * time.Second}
ctx := context.WithValue(context.Background(), oauth2.HTTPClient, httpClient)
req, err := http.NewRequestWithContext(ctx, "GET", authURL.String(), nil)
if err != nil {
Expand All @@ -130,7 +130,7 @@ func (c OAuthClientConfig) GetCodeAuthToken(params ...string) (*oauth2.Token, er
}
code := redirectURL.Query().Get("code")
cfg := getOAuthClientConfig(c)
httpClient := &http.Client{Timeout: 5 * time.Second}
httpClient := &http.Client{Timeout: 60 * time.Second}
ctx := context.WithValue(context.Background(), oauth2.HTTPClient, httpClient)
opts := []oauth2.AuthCodeOption{}
for i := 0; i < len(params); i += 2 {
Expand Down

0 comments on commit d6e54dc

Please sign in to comment.