refreshtokentest

package
v0.3.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 8, 2026 License: Apache-2.0 Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package refreshtokentest is the shared contract suite for core.RefreshTokenStore's access-token bookkeeping: RecordAccessToken and the access tokens RevokeTokenFamily hands back. Revoking a refresh token has to take the access tokens issued from the same grant with it (RFC 7009 §2.1), and the store is the only place that knows which those are, so every backend runs these scenarios through RunAll.

See: https://www.rfc-editor.org/rfc/rfc7009#section-2.1 See: https://www.rfc-editor.org/rfc/rfc9700#section-4.14.2

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RunAll

func RunAll(t *testing.T, factory Factory)

RunAll runs every scenario against the factory's backend.

func TestConcurrentRecordsAllKept

func TestConcurrentRecordsAllKept(t *testing.T, factory Factory)

TestConcurrentRecordsAllKept: parallel refreshes on one unrotated token each append; a lost update would leave an access token that revocation can't find.

func TestExpiredAccessTokensDropped

func TestExpiredAccessTokensDropped(t *testing.T, factory Factory)

TestExpiredAccessTokensDropped: an expired access token needs no blacklist entry, and a record that is refreshed for days must not grow without bound.

func TestFamiliesAreIsolated

func TestFamiliesAreIsolated(t *testing.T, factory Factory)

TestFamiliesAreIsolated: revoking one session leaves another alone.

func TestRecordOnMissingToken

func TestRecordOnMissingToken(t *testing.T, factory Factory)

TestRecordOnMissingToken maps an unknown token to core.ErrTokenNotFound.

func TestRecordOnRevokedReportsRevoked

func TestRecordOnRevokedReportsRevoked(t *testing.T, factory Factory)

TestRecordOnRevokedReportsRevoked: a revocation that landed before the access token was recorded never saw it, so the caller has to be told.

func TestRevokeFamilyReturnsEveryGeneration

func TestRevokeFamilyReturnsEveryGeneration(t *testing.T, factory Factory)

TestRevokeFamilyReturnsEveryGeneration: an access token issued with the first refresh token is still live after rotation, and revoking the family through the newer token has to return it along with the newer one.

func TestRevokeUnknownFamily

func TestRevokeUnknownFamily(t *testing.T, factory Factory)

TestRevokeUnknownFamily is a no-op, not an error.

func TestSeveralAccessTokensOnOneRecord

func TestSeveralAccessTokensOnOneRecord(t *testing.T, factory Factory)

TestSeveralAccessTokensOnOneRecord: with rotation off (FAPI 2.0) one refresh token mints an access token per refresh.

Types

type Factory

type Factory func(t *testing.T) core.RefreshTokenStore

Factory returns a store over fresh (or at least isolated) storage for one scenario.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL