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

Method providedAuthCredentials

rest/handler.go:1441–1457  ·  view source on GitHub ↗

providedAuthCredentials returns true if basic auth or session auth is enabled

()

Source from the content-addressed store, hash-verified

1439
1440// providedAuthCredentials returns true if basic auth or session auth is enabled
1441func (h *handler) providedAuthCredentials() bool {
1442 username, _ := h.getBasicAuth()
1443 if username != "" {
1444 return true
1445 }
1446 token := h.getBearerToken()
1447 if token != "" {
1448 return true
1449 }
1450 cookieName := auth.DefaultCookieName
1451 if h.db != nil {
1452 authenticator := h.db.Authenticator(h.ctx())
1453 cookieName = authenticator.SessionCookieName
1454 }
1455 cookie, _ := h.rq.Cookie(cookieName)
1456 return cookie != nil
1457}
1458
1459// taggedEffectiveUserName returns the tagged effective name of the user for the request.
1460// e.g: '<ud>alice</ud>' or 'GUEST'

Callers 2

setUserForPublicAuthMethod · 0.95

Calls 4

getBasicAuthMethod · 0.95
getBearerTokenMethod · 0.95
ctxMethod · 0.95
AuthenticatorMethod · 0.45

Tested by

no test coverage detected