Documentation
¶
Overview ¶
Package component provides JWT token lifecycle integration for bootstrap.
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Component ¶
func Component() bootstrap.IComponent
Component wraps loadFromEnv as a bootstrap.IComponent.
Close is a no-op: the token package holds no resources that require release.
Register this component after env/log and before gin, alongside auth/component if the service also uses Casbin authorization:
Add(envComp.Component("config/app.toml")).
Add(logComp.Component()).
AddParallel(dbComp.Component()).
PreReady(initServices).
Add(tokenComp.Component()).
Add(ginComp.Component(func(r *gin.Engine) { ... })).
Example ¶
ExampleComponent shows how token.Component() is registered in a bootstrap chain. Init() reads jwt.issuer/jwt.access.secretcode/jwt.refresh.secretcode from env.
package main
import (
"fmt"
tokenComp "github.com/phcp-tech/common-library-golang/token/component"
)
func main() {
c := tokenComp.Component()
fmt.Println(c != nil)
fmt.Println(c.Name())
}
Output: true token
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.