directory
0.0.0-20150918021244-30f434642c45
Repository: https://github.com/jessonchan/fargo.git
Documentation: pkg.go.dev
# Packages
Package apiauth provides handlers to enable apiauth support.
Package auth provides handlers to enable basic auth support.
Package cors provides handlers to enable CORS support.
Package jwt provides JWT (Json Web Token) authentication
Usage In file main.go
import ( "github.com/astaxie/beego" "github.com/astaxie/beego/plugins/jwt" )
func main() { // JWT for Url matching /v1/* // PrivateKeyPath: The path for the private RSA key used by JWT // PublicKeyPath: The path for the public RSA key used by JWT // The list of Urls should be excluded from the JWT Auth beego.InsertFilter("/v1/*", beego.BeforeRouter, jwt.AuthRequest(&jwt.Options{ PrivateKeyPath: "conf/beeblog.rsa", PublicKeyPath: "conf/beeblog.rsa.pub", WhiteList: []string{"/v1/jwt/issue-token", "/docs"}, })) beego.Run() }
In file routers/router.go
import ( "github.com/astaxie/beego" "github.com/astaxie/beego/plugins/jwt" ) func init() { ns := beego.NSNamespace("/jwt", beego.NSInclude( &jwt.JwtController{}, ), ) beego.AddNamespace(ns) }
.