login.go: Respect `overallTimeout` for LDAP login-related http requests

Signed-off-by: Matt Moyer <moyerm@vmware.com>
This commit is contained in:
Ryan Richard 2021-05-12 12:57:10 -07:00 committed by Matt Moyer
parent 3008d1a85c
commit 9ca72fcd30
1 changed files with 2 additions and 2 deletions

View File

@ -404,7 +404,7 @@ func (h *handlerState) cliBasedAuth(authorizeOptions *[]oauth2.AuthCodeOption) (
} }
// Send an authorize request. // Send an authorize request.
authCtx, authorizeCtxCancelFunc := context.WithTimeout(context.Background(), httpRequestTimeout) authCtx, authorizeCtxCancelFunc := context.WithTimeout(h.ctx, httpRequestTimeout)
defer authorizeCtxCancelFunc() defer authorizeCtxCancelFunc()
authReq, err := http.NewRequestWithContext(authCtx, http.MethodGet, authorizeURL, nil) authReq, err := http.NewRequestWithContext(authCtx, http.MethodGet, authorizeURL, nil)
if err != nil { if err != nil {
@ -454,7 +454,7 @@ func (h *handlerState) cliBasedAuth(authorizeOptions *[]oauth2.AuthCodeOption) (
// Exchange the authorization code for access, ID, and refresh tokens and perform required // Exchange the authorization code for access, ID, and refresh tokens and perform required
// validations on the returned ID token. // validations on the returned ID token.
tokenCtx, tokenCtxCancelFunc := context.WithTimeout(context.Background(), httpRequestTimeout) tokenCtx, tokenCtxCancelFunc := context.WithTimeout(h.ctx, httpRequestTimeout)
defer tokenCtxCancelFunc() defer tokenCtxCancelFunc()
token, err := h.getProvider(h.oauth2Config, h.provider, h.httpClient). token, err := h.getProvider(h.oauth2Config, h.provider, h.httpClient).
ExchangeAuthcodeAndValidateTokens( ExchangeAuthcodeAndValidateTokens(