MCPcopy Create free account
hub / github.com/dnote/dnote / getSessionKeyFromCookie

Function getSessionKeyFromCookie

pkg/server/middleware/helpers.go:96–106  ·  view source on GitHub ↗

getSessionKeyFromCookie reads and returns a session key from the cookie sent by the request. If no session key is found, it returns an empty string

(r *http.Request)

Source from the content-addressed store, hash-verified

94// getSessionKeyFromCookie reads and returns a session key from the cookie sent by the
95// request. If no session key is found, it returns an empty string
96func getSessionKeyFromCookie(r *http.Request) (string, error) {
97 c, err := r.Cookie("id")
98
99 if err == http.ErrNoCookie {
100 return "", nil
101 } else if err != nil {
102 return "", errors.Wrap(err, "reading cookie")
103 }
104
105 return c.Value, nil
106}
107
108type authHeader struct {
109 scheme string

Callers 2

GetCredentialFunction · 0.70

Calls

no outgoing calls

Tested by 1