9// splitAuthHeader takes the auth header value and splits it into the token type
10// and the token value.
11func splitAuthHeader(header string) (string, string, error) {
12 s := strings.Split(header, " ")
14 return "", "", fmt.Errorf("invalid authorization header: %q", header)
16 return s[0], s[1], nil
19// getBasicAuthCredentials decodes a basic auth token and extracts the user
21func getBasicAuthCredentials(token string) (string, string, error) {
22 b, err := base64.StdEncoding.DecodeString(token)
24 return "", "", fmt.Errorf("invalid basic auth token: %v", err)
27 pair := strings.SplitN(string(b), ":", 2)
29 return "", "", fmt.Errorf("invalid format: %q", b)
32 return pair[0], pair[1], nil
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list