BasicAuthDecode decodes username and password portions of HTTP Basic Authentication from encoded content.
(encoded string)
| 49 | // BasicAuthDecode decodes username and password portions of HTTP Basic Authentication |
| 50 | // from encoded content. |
| 51 | func BasicAuthDecode(encoded string) (string, string, error) { |
| 52 | s, err := base64.StdEncoding.DecodeString(encoded) |
| 53 | if err != nil { |
| 54 | return "", "", err |
| 55 | } |
| 56 | |
| 57 | auth := strings.SplitN(string(s), ":", 2) |
| 58 | return auth[0], auth[1], nil |
| 59 | } |
| 60 | |
| 61 | // verify time limit code |
| 62 | func VerifyTimeLimitCode(data string, minutes int, code string) bool { |
no test coverage detected