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

Method CreateStore

store/factory.go:61–80  ·  view source on GitHub ↗

CreateStore creates a token store based on the provided configuration

(config *Config)

Source from the content-addressed store, hash-verified

59
60// CreateStore creates a token store based on the provided configuration
61func (f *Factory) CreateStore(config *Config) (core.TokenStore, error) {
62 if config == nil {
63 config = DefaultConfig()
64 }
65
66 switch config.Type {
67 case MemoryStore:
68 return NewInMemoryRefreshTokenStore(), nil
69
70 case RedisStore:
71 redisConfig := config.Redis
72 if redisConfig == nil {
73 redisConfig = DefaultRedisConfig()
74 }
75 return NewRedisRefreshTokenStore(redisConfig)
76
77 default:
78 return nil, fmt.Errorf("unsupported store type: %s", config.Type)
79 }
80}
81
82// Convenience functions for creating stores
83

Calls 4

DefaultConfigFunction · 0.85
DefaultRedisConfigFunction · 0.85