Documentation
¶
Overview ¶
Package refreshtokentest is the shared contract suite for core.RefreshTokenStore's access-token bookkeeping: RecordAccessToken, and the access tokens RevokeTokenFamily and RevokeSubjectTokens hand back. It also checks that the OIDC grant a refresh needs survives rotation. 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 ¶
- func RunAll(t *testing.T, factory Factory)
- func TestConcurrentRecordsAllKept(t *testing.T, factory Factory)
- func TestExpiredAccessTokensDropped(t *testing.T, factory Factory)
- func TestFamiliesAreIsolated(t *testing.T, factory Factory)
- func TestOIDCGrantSurvivesRotation(t *testing.T, factory Factory)
- func TestRecordOnMissingToken(t *testing.T, factory Factory)
- func TestRecordOnRevokedReportsRevoked(t *testing.T, factory Factory)
- func TestResourcesSurviveRotation(t *testing.T, factory Factory)
- func TestRevokeFamilyReturnsEveryGeneration(t *testing.T, factory Factory)
- func TestRevokeSubjectReturnsAccessTokens(t *testing.T, factory Factory)
- func TestRevokeUnknownFamily(t *testing.T, factory Factory)
- func TestRevokeUnknownSubject(t *testing.T, factory Factory)
- func TestSeveralAccessTokensOnOneRecord(t *testing.T, factory Factory)
- type Factory
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TestConcurrentRecordsAllKept ¶
TestConcurrentRecordsAllKept: parallel refreshes on one unrotated token each append; a lost update would leave an access token that revocation can't find.
func TestExpiredAccessTokensDropped ¶
TestExpiredAccessTokensDropped: an expired access token needs no blacklist entry, and a record that is refreshed for days must not grow without bound.
func TestFamiliesAreIsolated ¶
TestFamiliesAreIsolated: revoking one session leaves another alone.
func TestOIDCGrantSurvivesRotation ¶ added in v0.3.11
TestOIDCGrantSurvivesRotation: a refreshed ID token reports the original login (OIDC Core §12.2), so the store has to keep the login's auth_time, acr, amr and claims request through every rotation.
See: https://openid.net/specs/openid-connect-core-1_0.html#RefreshTokenResponse
func TestRecordOnMissingToken ¶
TestRecordOnMissingToken maps an unknown token to core.ErrTokenNotFound.
func TestRecordOnRevokedReportsRevoked ¶
TestRecordOnRevokedReportsRevoked: a revocation that landed before the access token was recorded never saw it, so the caller has to be told.
func TestResourcesSurviveRotation ¶ added in v0.3.12
TestResourcesSurviveRotation: a refresh may bind its access token to any of the grant's RFC 8707 resources and no others, so the store has to keep them through every rotation. Losing them would let a refresh name any allowed resource.
func TestRevokeFamilyReturnsEveryGeneration ¶
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 TestRevokeSubjectReturnsAccessTokens ¶ added in v0.3.11
TestRevokeSubjectReturnsAccessTokens: logout-all and password reset revoke every session the user has, so they must get back the live access tokens of every family. That includes one issued before a rotation and one whose refresh token was revoked earlier, and excludes an expired one and another user's.
func TestRevokeUnknownFamily ¶
TestRevokeUnknownFamily is a no-op, not an error.
func TestRevokeUnknownSubject ¶ added in v0.3.11
TestRevokeUnknownSubject is a no-op, not an error.
func TestSeveralAccessTokensOnOneRecord ¶
TestSeveralAccessTokensOnOneRecord: with rotation off (FAPI 2.0) one refresh token mints an access token per refresh.