Documentation
¶
Index ¶
- Constants
- Variables
- func Add(controller interface{})
- func GetSignKey() *rsa.PrivateKey
- func InitJwt(wd string) error
- func NewTestServer(t *testing.T, controllers ...interface{}) (*httpexpect.Expect, error)
- type Application
- type ApplicationInterface
- type Context
- func (ctx *Context) Do(handlers context.Handlers)
- func (ctx *Context) HTML(htmlContents string) (int, error)
- func (ctx *Context) Next()
- func (ctx *Context) RequestBody(data interface{}) error
- func (ctx *Context) ResponseBody(message string, data interface{})
- func (ctx *Context) ResponseError(message string, code int)
- type ContextInterface
- type Controller
- type Health
- type JwtMap
- type JwtMiddleware
- type Token
Constants ¶
View Source
const ( AuthTypeDefault = "" AuthTypeAnon = "anon" AuthTypeJwt = "jwt" )
Variables ¶
View Source
var (
Controllers []interface{}
)
Functions ¶
func GetSignKey ¶
func GetSignKey() *rsa.PrivateKey
func NewTestServer ¶
func NewTestServer(t *testing.T, controllers ...interface{}) (*httpexpect.Expect, error)
Types ¶
type Application ¶
type Application struct {
// contains filtered or unexported fields
}
func NewApplication ¶
func NewApplication(controllers ...interface{}) *Application
func (*Application) Config ¶
func (wa *Application) Config() *system.Configuration
func (*Application) Init ¶
func (wa *Application) Init(controllers []interface{}) error
func (*Application) Run ¶
func (wa *Application) Run()
func (*Application) RunTestServer ¶
func (wa *Application) RunTestServer(t *testing.T) *httpexpect.Expect
type ApplicationInterface ¶
type ApplicationInterface interface {
Init()
Config() *system.Configuration
GetSignKey() *rsa.PrivateKey
Run()
NewTestServer(t *testing.T) *httpexpect.Expect
}
type Context ¶
type Context struct {
// Optional Part 1: embed (optional but required if you don't want to override all context's methods)
context.Context // it's the context/context.go#context struct but you don't need to know it.
ContextInterface
}
Create your own custom Context, put any fields you wanna need.
func (*Context) Do ¶
The only one important if you will override the Context with an embedded context.Context inside it. Required in order to run the handlers via this "*Context".
func (*Context) Next ¶
func (ctx *Context) Next()
The second one important if you will override the Context with an embedded context.Context inside it. Required in order to run the chain of handlers via this "*Context".
func (*Context) ResponseBody ¶
set response
func (*Context) ResponseError ¶
set response
type ContextInterface ¶
type Controller ¶
type JwtMiddleware ¶
type JwtMiddleware struct {
jwtmiddleware.Middleware
}
func GetJwtHandler ¶
func GetJwtHandler() *JwtMiddleware
func NewJwtMiddlware ¶
func NewJwtMiddlware(cfg ...jwtmiddleware.Config) *JwtMiddleware
New constructs a new Secure instance with supplied options.
func (*JwtMiddleware) CheckJWT ¶
func (m *JwtMiddleware) CheckJWT(ctx context.Context) error
CheckJWT the main functionality, checks for token
func (*JwtMiddleware) Serve ¶
func (m *JwtMiddleware) Serve(ctx context.Context)
Serve the middleware's action
Click to show internal directories.
Click to hide internal directories.