Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrResrouceMissing 未提供资源 ErrResrouceMissing = errors.New("required resource not found") )
Functions ¶
Types ¶
type Config ¶
type Config struct { // 资源 ResourceValue string // The function that will be called when there's an error validating the token // Default value: ErrorHandler errorHandler }
Config is
type Middleware ¶
type Middleware struct {
Config Config
}
Middleware the middleware for JSON Web tokens authentication method
func New ¶
func New(resource string) *Middleware
New constructs a new Secure instance with supplied options.
func (*Middleware) CheckAccessControl ¶
func (m *Middleware) CheckAccessControl(ctx context.Context) error
CheckAccessControl the main functionality, checks for token
func (*Middleware) Serve ¶
func (m *Middleware) Serve(ctx context.Context)
Serve the middleware's action
Click to show internal directories.
Click to hide internal directories.