MCPcopy Create free account
hub / github.com/syncthing/syncthing / hasValidSession

Method hasValidSession

lib/api/tokenmanager.go:227–240  ·  view source on GitHub ↗
(r *http.Request)

Source from the content-addressed store, hash-verified

225}
226
227func (m *tokenCookieManager) hasValidSession(r *http.Request) bool {
228 for _, cookie := range r.Cookies() {
229 // We iterate here since there may, historically, be multiple
230 // cookies with the same name but different path. Any "old" ones
231 // won't match an existing session and will be ignored, then
232 // later removed on logout or when timing out.
233 if cookie.Name == m.cookieName {
234 if m.tokens.Check(cookie.Value) {
235 return true
236 }
237 }
238 }
239 return false
240}
241
242func (m *tokenCookieManager) destroySession(w http.ResponseWriter, r *http.Request) {
243 for _, cookie := range r.Cookies() {

Callers 1

ServeHTTPMethod · 0.80

Calls 1

CheckMethod · 0.80

Tested by

no test coverage detected