(auth []AuthConfig, requestURL string, kind string)
| 189 | } |
| 190 | |
| 191 | func matchingAuthConfig(auth []AuthConfig, requestURL string, kind string) (AuthConfig, bool) { |
| 192 | requestURL = strings.TrimSpace(requestURL) |
| 193 | kind = strings.ToLower(strings.TrimSpace(kind)) |
| 194 | for _, item := range NormalizeAuthConfigs(auth) { |
| 195 | if !pluginStoreURLMatchesAuthRule(requestURL, item.Match) { |
| 196 | continue |
| 197 | } |
| 198 | if !authAppliesTo(item, kind) { |
| 199 | continue |
| 200 | } |
| 201 | return item, true |
| 202 | } |
| 203 | return AuthConfig{}, false |
| 204 | } |
| 205 | |
| 206 | func pluginStoreURLMatchesAuthRule(requestURL string, matchURL string) bool { |
| 207 | request, errRequest := url.Parse(strings.TrimSpace(requestURL)) |
no test coverage detected