MCPcopy Create free account
hub / github.com/couchbase/sync_gateway / getBasicAuth

Method getBasicAuth

rest/handler.go:1417–1429  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1415}
1416
1417func (h *handler) getBasicAuth() (username string, password string) {
1418 auth := h.rq.Header.Get("Authorization")
1419 if strings.HasPrefix(auth, "Basic ") {
1420 decoded, err := base64.StdEncoding.DecodeString(auth[6:])
1421 if err == nil {
1422 components := strings.SplitN(string(decoded), ":", 2)
1423 if len(components) == 2 {
1424 return components[0], components[1]
1425 }
1426 }
1427 }
1428 return
1429}
1430
1431func (h *handler) getBearerToken() string {
1432 auth := h.rq.Header.Get("Authorization")

Callers 4

setUserForPublicAuthMethod · 0.95

Calls 1

GetMethod · 0.45

Tested by

no test coverage detected