Package jwt is an Ambient plugin that enables jwt.
Import: github.com/ambientkit/plugin/middleware/jwt
Version: 1.0.0
The plugin can be used as the following core types:
- Logger: false
- Storage System: false
- Router: false
- Template Engine: false
- Session Manager: false
The plugin request the following grants (1):
- Name: router.middleware:write
- Description: Access to force authentication on routes using JWTs.
The plugin does not have any settings.
The plugin does not have any routes.
The plugin has middleware (1).
The plugin does not have a FuncMap.
The plugin does not inject any assets.
The plugin does not have any embedded files.
package main
import (
"log"
"time"
"github.com/ambientkit/ambient"
"github.com/ambientkit/ambient/pkg/ambientapp"
"github.com/ambientkit/plugin/logger/zaplogger"
"github.com/ambientkit/plugin/middleware/jwt"
"github.com/ambientkit/plugin/pkg/uuid"
"github.com/ambientkit/plugin/storage/memorystorage"
)
func main() {
plugins := &ambient.PluginLoader{
// Core plugins are implicitly trusted.
Router: nil,
TemplateEngine: nil,
SessionManager: nil,
// Trusted plugins are those that are typically needed to boot so they
// will be enabled and given full access.
TrustedPlugins: map[string]bool{},
Plugins: []ambient.Plugin{},
Middleware: []ambient.MiddlewarePlugin{
// Middleware - executes top to bottom.
jwt.New([]byte(uuid.EncodedString(32)), time.Hour*1, []string{}),
},
}
_, _, err := ambientapp.NewApp("myapp", "1.0",
zaplogger.New(),
ambient.StoragePluginGroup{
Storage: memorystorage.New(),
},
plugins)
if err != nil {
log.Fatalln(err.Error())
}
}Docgen by Ambient