Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( Authentication = func(next http.Handler) http.Handler { return http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { claims := map[string]interface{}{ "userid": float64(1), "fullname": "unknown", "email": "test", "scope": "test", } req = req.WithContext(context.WithValue(req.Context(), contextkey.AccessToken, claims)) req = req.WithContext(context.WithValue(req.Context(), contextkey.AccessTokenKey, "test")) next.ServeHTTP(res, req) }) } AuthenticationWithCustomClaims = func(customClaims map[string]interface{}) func(next http.Handler) http.Handler { return func(next http.Handler) http.Handler { return http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { claims := map[string]interface{}{ "userid": float64(1), "fullname": "unknown", "email": "test", } for key, val := range customClaims { claims[key] = val } req = req.WithContext(context.WithValue(req.Context(), contextkey.AccessToken, claims)) req = req.WithContext(context.WithValue(req.Context(), contextkey.AccessTokenKey, "test")) next.ServeHTTP(res, req) }) } } )
View Source
var ( Bypass = func(next http.Handler) http.Handler { return http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { next.ServeHTTP(res, req) }) } BypassWithArgs = func(next http.Handler, args ...interface{}) http.Handler { return http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { next.ServeHTTP(res, req) }) } )
View Source
var ( ClientParser = func(next http.Handler, args ...interface{}) http.Handler { return http.HandlerFunc(func(res http.ResponseWriter, req *http.Request) { clientInfoMap := map[string]interface{}{ "client_id": -1, "client_name": "unknown", "ip": "test", "user_agent": "test", } req = req.WithContext(context.WithValue(req.Context(), contextkey.ClientInfo, map[string]interface{}(clientInfoMap))) next.ServeHTTP(res, req) }) } )
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.