mirror of
https://github.com/kreuzwerker/terraform-provider-docker.git
synced 2025-12-20 22:59:42 -05:00
fix: Handle Auth Header Scopes (#482)
* fix: check for auth header length * fix: expand url scope
This commit is contained in:
parent
ffb0cbfb75
commit
42d37d3214
1 changed files with 2 additions and 1 deletions
|
|
@ -9,6 +9,7 @@ import (
|
|||
"io/ioutil"
|
||||
"net/http"
|
||||
"net/url"
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/hashicorp/terraform-plugin-sdk/v2/diag"
|
||||
|
|
@ -153,7 +154,7 @@ type TokenResponse struct {
|
|||
// Parses key/value pairs from a WWW-Authenticate header
|
||||
func parseAuthHeader(header string) map[string]string {
|
||||
parts := strings.SplitN(header, " ", 2)
|
||||
parts = strings.Split(parts[1], ",")
|
||||
parts = regexp.MustCompile(`\w+\=\".*?\"|\w+[^\s\"]+?`).FindAllString(parts[1], -1) // expression to match auth headers.
|
||||
opts := make(map[string]string)
|
||||
|
||||
for _, part := range parts {
|
||||
|
|
|
|||
Loading…
Reference in a new issue