clientassertion

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Oct 11, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package clientassertion records the JWT IDs of used client assertions so that a signed assertion cannot be replayed before it expires. It provides the JTI half of Fosite's ClientManager for Ent-backed storage.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type JTIStore

type JTIStore struct {
	// contains filtered or unexported fields
}

JTIStore tracks used client-assertion JWT IDs in the database.

func NewJTIStore

func NewJTIStore(db *ent.Client) *JTIStore

NewJTIStore returns a JTIStore backed by db.

func (*JTIStore) Mark

func (s *JTIStore) Mark(ctx context.Context, jti string, exp time.Time) error

Mark records jti as used until exp, first forgetting JTIs that have expired. Marking a JTI that is still live returns fosite.ErrJTIKnown. It implements fosite.ClientManager.SetClientAssertionJWT.

func (*JTIStore) Valid

func (s *JTIStore) Valid(ctx context.Context, jti string) error

Valid returns fosite.ErrJTIKnown when jti has been used and has not yet expired, and nil otherwise. It implements fosite.ClientManager.ClientAssertionJWTValid.

type MemoryJTIStore

type MemoryJTIStore struct {
	// contains filtered or unexported fields
}

MemoryJTIStore tracks used client-assertion JWT IDs in memory, with the same semantics as JTIStore. It suits a single instance; replicas need the database-backed store, since a replayed assertion can reach any of them.

func NewMemoryJTIStore

func NewMemoryJTIStore() *MemoryJTIStore

NewMemoryJTIStore returns an empty MemoryJTIStore.

func (*MemoryJTIStore) Mark

func (s *MemoryJTIStore) Mark(_ context.Context, jti string, exp time.Time) error

Mark records jti as used until exp, first forgetting JTIs that have expired. Marking a JTI that is still live returns fosite.ErrJTIKnown.

func (*MemoryJTIStore) Valid

func (s *MemoryJTIStore) Valid(_ context.Context, jti string) error

Valid returns fosite.ErrJTIKnown when jti has been used and has not yet expired, and nil otherwise.

Jump to

Keyboard shortcuts

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