Documentation
¶
Index ¶
- Constants
- Variables
- func AsMiddleware(f any) any
- func AsSuperTokensMiddleware() any
- func AsSuperTokensWrapperMiddleware() any
- func AsVerifySessionMiddleware() any
- func DefaultCORSHandler() echo.MiddlewareFunc
- func InitSuperTokens(config *SuperTokensConfig) error
- func NewSuperTokensMiddleware(config *SuperTokensConfig) echo.MiddlewareFunc
- func NewSuperTokensWrapperMiddleware() echo.MiddlewareFunc
- func NewVerifySessionMiddleware(config *SuperTokensConfig) echo.MiddlewareFunc
- func SuperTokensMiddlewareWrapper() echo.MiddlewareFunc
- func SupertokenMiddleware(config *SuperTokensConfig) echo.MiddlewareFunc
- func VerifySession(config *SuperTokensConfig) echo.MiddlewareFunc
- type MiddlewareRegistryIf
- type SuperTokensConfig
- type SuperTokensMiddlewareRegistry
Constants ¶
const ModuleName = "fxsupertoken"
Variables ¶
var FxInit = fx.Invoke(InitSuperTokens)
FxInit is the fx invoke function for initializing SuperTokens
var FxSupertoken = fx.Module( ModuleName, fx.Provide( NewSuperTokensConfig, fx.Annotate( NewSuperTokensMiddlewareRegistry, fx.ResultTags(`group:"middlewares"`), ), fx.Annotate( NewVerifySessionMiddlewareRegistry, fx.ResultTags(`group:"middlewares"`), ), fx.Annotate( NewSuperTokensWrapperMiddlewareRegistry, fx.ResultTags(`group:"middlewares"`), ), ), fx.Invoke(InitSuperTokens), )
Functions ¶
func AsMiddleware ¶
AsMiddleware annotates a middleware constructor for fxEcho compatibility
func AsSuperTokensMiddleware ¶
func AsSuperTokensMiddleware() any
AsSuperTokensMiddleware annotates SuperTokens middleware for fxEcho
func AsSuperTokensWrapperMiddleware ¶
func AsSuperTokensWrapperMiddleware() any
AsSuperTokensWrapperMiddleware annotates SuperTokens wrapper middleware for fxEcho
func AsVerifySessionMiddleware ¶
func AsVerifySessionMiddleware() any
AsVerifySessionMiddleware annotates session verification middleware for fxEcho
func DefaultCORSHandler ¶
func DefaultCORSHandler() echo.MiddlewareFunc
DefaultCORSHandler returns a custom CORS middleware with specific allowed origins Includes localhost ports for development and production UTOL domains
func InitSuperTokens ¶
func InitSuperTokens(config *SuperTokensConfig) error
InitSuperTokens initializes SuperTokens with the provided configuration
func NewSuperTokensMiddleware ¶
func NewSuperTokensMiddleware(config *SuperTokensConfig) echo.MiddlewareFunc
NewSuperTokensMiddleware creates the main SuperTokens middleware
func NewSuperTokensWrapperMiddleware ¶
func NewSuperTokensWrapperMiddleware() echo.MiddlewareFunc
NewSuperTokensWrapperMiddleware creates the SuperTokens wrapper middleware
func NewVerifySessionMiddleware ¶
func NewVerifySessionMiddleware(config *SuperTokensConfig) echo.MiddlewareFunc
NewVerifySessionMiddleware creates the session verification middleware
func SuperTokensMiddlewareWrapper ¶
func SuperTokensMiddlewareWrapper() echo.MiddlewareFunc
SuperTokensMiddlewareWrapper wraps SuperTokens middleware for Echo
func SupertokenMiddleware ¶
func SupertokenMiddleware(config *SuperTokensConfig) echo.MiddlewareFunc
SupertokenMiddleware creates a middleware that checks if SuperTokens is initialized
func VerifySession ¶
func VerifySession(config *SuperTokensConfig) echo.MiddlewareFunc
VerifySession creates a middleware that verifies SuperTokens session
Types ¶
type MiddlewareRegistryIf ¶
type MiddlewareRegistryIf interface {
Priority() int
Middleware() echo.MiddlewareFunc
}
MiddlewareRegistryIf defines the interface for middleware registration
func NewSuperTokensMiddlewareRegistry ¶
func NewSuperTokensMiddlewareRegistry(config *SuperTokensConfig) MiddlewareRegistryIf
NewSuperTokensMiddlewareRegistry creates a middleware registry for SuperTokens
func NewSuperTokensWrapperMiddlewareRegistry ¶
func NewSuperTokensWrapperMiddlewareRegistry() MiddlewareRegistryIf
NewSuperTokensWrapperMiddlewareRegistry creates a middleware registry for SuperTokens wrapper
func NewVerifySessionMiddlewareRegistry ¶
func NewVerifySessionMiddlewareRegistry(config *SuperTokensConfig) MiddlewareRegistryIf
NewVerifySessionMiddlewareRegistry creates a middleware registry for session verification
type SuperTokensConfig ¶
type SuperTokensConfig struct {
ConnectionURI string `mapstructure:"connection_uri"`
ConnectionAPIKey string `mapstructure:"connection_api_key"`
EmailHost string `mapstructure:"email.host"`
EmailPassword string `mapstructure:"email.password"`
Email string `mapstructure:"email"`
APIBasePath string `mapstructure:"api_base_path"`
WebBasePath string `mapstructure:"web_base_path"`
AppName string `mapstructure:"app_name"`
APIDomain string `mapstructure:"api_domain"`
WebsiteDomain string `mapstructure:"website_domain"`
IsInitialized bool // Track if SuperTokens is properly initialized
}
SuperTokensConfig holds SuperTokens configuration
func NewSuperTokensConfig ¶
func NewSuperTokensConfig(config *fxConfig.Config) (*SuperTokensConfig, error)
NewSuperTokensConfig creates SuperTokens configuration from fxConfig
type SuperTokensMiddlewareRegistry ¶
type SuperTokensMiddlewareRegistry struct {
// contains filtered or unexported fields
}
SuperTokensMiddlewareRegistry implements MiddlewareRegistryIf for SuperTokens middleware
func (*SuperTokensMiddlewareRegistry) Middleware ¶
func (s *SuperTokensMiddlewareRegistry) Middleware() echo.MiddlewareFunc
func (*SuperTokensMiddlewareRegistry) Priority ¶
func (s *SuperTokensMiddlewareRegistry) Priority() int