MCPcopy Create free account
hub / github.com/gogs/gogs / BasicAuthDecode

Function BasicAuthDecode

internal/tool/tool.go:51–59  ·  view source on GitHub ↗

BasicAuthDecode decodes username and password portions of HTTP Basic Authentication from encoded content.

(encoded string)

Source from the content-addressed store, hash-verified

49// BasicAuthDecode decodes username and password portions of HTTP Basic Authentication
50// from encoded content.
51func 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
62func VerifyTimeLimitCode(data string, minutes int, code string) bool {

Callers 2

authenticatedUserFunction · 0.92
HTTPContexterFunction · 0.92

Calls 1

stringFunction · 0.85

Tested by

no test coverage detected