Set stores a refresh token with associated user data and expiration
( ctx context.Context, token string, userData any, expiry time.Time, )
| 28 | |
| 29 | // Set stores a refresh token with associated user data and expiration |
| 30 | func (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 |
| 53 | func (s *InMemoryRefreshTokenStore) Get(ctx context.Context, token string) (any, error) { |
no outgoing calls