MCPcopy
hub / github.com/oauth2-proxy/oauth2-proxy / loadSession

Method loadSession

pkg/sessions/persistence/ticket.go:180–197  ·  view source on GitHub ↗

loadSession 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. finally it appends a lock implementation

(loader loadFunc, initLock initLockFunc)

Source from the content-addressed store, hash-verified

178// ticket.secret to make the AES-GCM cipher.
179// finally it appends a lock implementation
180func (t *ticket) loadSession(loader loadFunc, initLock initLockFunc) (*sessions.SessionState, error) {
181 ciphertext, err := loader(t.id)
182 if err != nil {
183 return nil, fmt.Errorf("failed to load the session state with the ticket: %v", err)
184 }
185 c, err := t.makeCipher()
186 if err != nil {
187 return nil, err
188 }
189
190 sessionState, err := sessions.DecodeSessionState(ciphertext, c, false)
191 if err != nil {
192 return nil, err
193 }
194 lock := initLock(t.id)
195 sessionState.Lock = lock
196 return sessionState, nil
197}
198
199// clearSession uses the passed clearFunc to delete a session stored with a
200// key of ticket.id

Callers 2

ticket_test.goFile · 0.45
LoadMethod · 0.45

Calls 2

makeCipherMethod · 0.95
DecodeSessionStateFunction · 0.92

Tested by

no test coverage detected