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

Method GetRefreshTokenSession

internal/oauth/storage.go:397–420  ·  view source on GitHub ↗
(ctx context.Context, signature string, session fosite.Session)

Source from the content-addressed store, hash-verified

395}
396
397func (s *Storage) GetRefreshTokenSession(ctx context.Context, signature string, session fosite.Session) (fosite.Requester, error) {
398 var raw []byte
399 var active bool
400 var revokedAt *time.Time
401 err := s.db(ctx).QueryRow(ctx, `
402 SELECT request, active, revoked_at FROM oauth_refresh_tokens WHERE signature = $1
403 `, signature).Scan(&raw, &active, &revokedAt)
404 if errors.Is(err, pgx.ErrNoRows) {
405 return nil, fosite.ErrNotFound
406 }
407 if err != nil {
408 return nil, err
409 }
410 req, err := s.hydrate(ctx, raw, session)
411 if err != nil {
412 return nil, err
413 }
414 if !active || revokedAt != nil {
415 // fosite contract: return both the Requester (so caller can
416 // extract the request_id for chain revoke) and ErrInactiveToken.
417 return req, fosite.ErrInactiveToken
418 }
419 return req, nil
420}
421
422func (s *Storage) DeleteRefreshTokenSession(ctx context.Context, signature string) error {
423 _, err := s.db(ctx).Exec(ctx,

Callers

nothing calls this directly

Calls 4

dbMethod · 0.95
hydrateMethod · 0.95
ScanMethod · 0.80
QueryRowMethod · 0.80

Tested by

no test coverage detected