(auth string)
| 402 | } |
| 403 | |
| 404 | func parseBasicAuth(auth string) (username, password string, ok bool) { |
| 405 | const prefix = "Basic " |
| 406 | if len(auth) < len(prefix) || !strings.EqualFold(auth[:len(prefix)], prefix) { |
| 407 | return "", "", false |
| 408 | } |
| 409 | |
| 410 | decoded, err := base64.StdEncoding.DecodeString(auth[len(prefix):]) |
| 411 | if err != nil { |
| 412 | return "", "", false |
| 413 | } |
| 414 | |
| 415 | decodedStr := string(decoded) |
| 416 | before, after, ok0 := strings.Cut(decodedStr, ":") |
| 417 | if !ok0 { |
| 418 | return "", "", false |
| 419 | } |
| 420 | |
| 421 | return before, after, true |
| 422 | } |
no outgoing calls
no test coverage detected
searching dependent graphs…