providedAuthCredentials returns true if basic auth or session auth is enabled
()
| 1439 | |
| 1440 | // providedAuthCredentials returns true if basic auth or session auth is enabled |
| 1441 | func (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' |
no test coverage detected