| 225 | } |
| 226 | |
| 227 | func (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 | |
| 242 | func (m *tokenCookieManager) destroySession(w http.ResponseWriter, r *http.Request) { |
| 243 | for _, cookie := range r.Cookies() { |