Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNoHeader = errors.New("no authorization in header") ErrInvalidAuth = errors.New("invalid authentication") )
errors
Functions ¶
Types ¶
type Auth ¶
type Auth struct { SecretFunc token.SecretFunc //required Expire time.Duration Realm string //required //optional. Authorize check whether this request could access some resource or API based on json claims. //Typically, this method should communicate with a RBAC, ABAC system Authorize func(payload map[string]interface{}, req *http.Request) error //optional. // this function control whether a request should be validate or not // if this func is nil, validate all requests. MustAuth func(req *http.Request) bool }
Auth should implement auth logic it is singleton
type Handler ¶
type Handler struct { }
Handler is is a jwt interceptor
func (*Handler) Handle ¶
func (h *Handler) Handle(chain *handler.Chain, i *invocation.Invocation, cb invocation.ResponseCallBack)
Handle intercept unauthorized request
Click to show internal directories.
Click to hide internal directories.