1
0
mirror of https://github.com/oauth2-proxy/oauth2-proxy.git synced 2025-11-06 08:59:21 +02:00

Split RefreshSessionIfNeeded in two methods and use Redis lock

This commit is contained in:
Kevin Kreitner
2021-02-22 08:33:53 +01:00
parent b942eb1582
commit 69d6fc8a08
21 changed files with 297 additions and 145 deletions

View File

@@ -139,13 +139,11 @@ func (t *ticket) loadSession(loader loadFunc) (*sessions.SessionState, error) {
return sessions.DecodeSessionState(ciphertext, c, false)
}
// lockSession loads a session from the disk store via the passed loadFunc
// using the ticket.id as the key. It then decodes the SessionState using
// ticket.secret to make the AES-GCM cipher.
func (t *ticket) lockSession(loader lockFunc) error {
// releaseSession releases a potential locked session
func (t *ticket) releaseSession(loader lockFunc) error {
err := loader(t.id)
if err != nil {
return fmt.Errorf("failed to lock the session state with the ticket: %v", err)
return fmt.Errorf("failed to release session state with the ticket: %v", err)
}
return nil
}