Documentation
¶
Overview ¶
Package app provides the public entry point for the go-core authentication module. Consumers call New to initialize, RegisterRoutes to mount handlers onto a Gin engine, and Close to shut down gracefully.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type App ¶
type App struct {
// contains filtered or unexported fields
}
App is the public entry point for the go-core authentication module. All internal services are hidden behind an opaque struct — consumers interact only through RegisterRoutes and Close.
func New ¶
New validates the configuration and initializes the go-core module. It creates and owns its own database connection pool.
func NewWithDB ¶
NewWithDB validates the configuration and initializes the go-core module using an externally managed database connection pool. The caller retains ownership of the pool and is responsible for closing it.
func (*App) AuthMiddleware ¶
func (a *App) AuthMiddleware() gin.HandlerFunc
AuthMiddleware returns a Gin handler that enforces JWT authentication. Drop it into any route or group the consumer controls:
r.GET("/profile", coreApp.AuthMiddleware(), profileHandler)
api := r.Group("/api", coreApp.AuthMiddleware())
func (*App) Close ¶
func (a *App) Close()
Close gracefully shuts down all background services and the database connection pool owned by the module.
func (*App) RegisterRoutes ¶
RegisterRoutes mounts all go-core HTTP routes (auth, admin, OIDC, etc.) onto the provided Gin engine. The consumer owns the engine and server lifecycle.