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

Method respondWithSessionInfoForSession

rest/session_api.go:317–331  ·  view source on GitHub ↗

Respond with a JSON struct containing info about the current login session

(session *auth.LoginSession)

Source from the content-addressed store, hash-verified

315
316// Respond with a JSON struct containing info about the current login session
317func (h *handler) respondWithSessionInfoForSession(session *auth.LoginSession) error {
318
319 user, err := h.db.Authenticator(h.ctx()).GetUser(session.Username)
320
321 // let the empty user case succeed
322 if err != nil {
323 return err
324 }
325
326 response := h.formatSessionResponse(user, "")
327 if response != nil {
328 h.writeJSON(response)
329 }
330 return nil
331}
332
333// Formats session response similar to what is returned by CouchDB
334func (h *handler) formatSessionResponse(user auth.User, oneTimeSessionID string) db.Body {

Callers 1

getUserSessionMethod · 0.95

Calls 5

ctxMethod · 0.95
formatSessionResponseMethod · 0.95
writeJSONMethod · 0.95
GetUserMethod · 0.80
AuthenticatorMethod · 0.45

Tested by

no test coverage detected