MCPcopy
hub / github.com/appleboy/gin-jwt / Set

Method Set

store/memory.go:30–50  ·  view source on GitHub ↗

Set stores a refresh token with associated user data and expiration

(
	ctx context.Context,
	token string,
	userData any,
	expiry time.Time,
)

Source from the content-addressed store, hash-verified

28
29// Set stores a refresh token with associated user data and expiration
30func (s *InMemoryRefreshTokenStore) Set(
31 ctx context.Context,
32 token string,
33 userData any,
34 expiry time.Time,
35) error {
36 if token == "" {
37 return errors.New("token cannot be empty")
38 }
39
40 s.mu.Lock()
41 defer s.mu.Unlock()
42
43 s.tokens[token] = &core.RefreshTokenData{
44 UserData: userData,
45 Expiry: expiry,
46 Created: time.Now(),
47 }
48
49 return nil
50}
51
52// Get retrieves user data associated with a refresh token
53func (s *InMemoryRefreshTokenStore) Get(ctx context.Context, token string) (any, error) {

Calls

no outgoing calls