MCPcopy Create free account
hub / github.com/Mnexa-AI/e2a / CreatePKCERequestSession

Method CreatePKCERequestSession

internal/oauth/storage.go:485–506  ·  view source on GitHub ↗

───────────────────────── PKCERequestStorage ─────────────────────────

(ctx context.Context, signature string, request fosite.Requester)

Source from the content-addressed store, hash-verified

483// ───────────────────────── PKCERequestStorage ─────────────────────────
484
485func (s *Storage) CreatePKCERequestSession(ctx context.Context, signature string, request fosite.Requester) error {
486 raw, err := marshalRequest(request)
487 if err != nil {
488 return err
489 }
490 // Mirror the auth-code expiry source. PKCE sessions are paired
491 // with codes (consumed at the same /token call) so using the same
492 // expiry keeps them in lockstep — the reaper won't drop the PKCE
493 // row out from under a still-valid code.
494 sess, _ := request.GetSession().(*Session)
495 expiresAt := request.GetRequestedAt().Add(15 * time.Minute)
496 if sess != nil {
497 if t := sess.GetExpiresAt(fosite.AuthorizeCode); !t.IsZero() {
498 expiresAt = t
499 }
500 }
501 _, err = s.db(ctx).Exec(ctx, `
502 INSERT INTO oauth_pkce_requests (signature, request_id, client_id, request, expires_at)
503 VALUES ($1, $2, $3, $4, $5)
504 `, signature, request.GetID(), request.GetClient().GetID(), raw, expiresAt)
505 return err
506}
507
508func (s *Storage) GetPKCERequestSession(ctx context.Context, signature string, session fosite.Session) (fosite.Requester, error) {
509 var raw []byte

Callers

nothing calls this directly

Calls 6

dbMethod · 0.95
marshalRequestFunction · 0.85
GetExpiresAtMethod · 0.80
GetIDMethod · 0.80
GetClientMethod · 0.80
ExecMethod · 0.65

Tested by

no test coverage detected