Esempio n. 1
0
func (a *app) routeLogin(rtr *ctxrouter.Router) {

	staticClaims := map[string]interface{}{
		"xfoo":  "bar",
		"xtime": time.Now().Unix(),
	}

	rtr.GET("/login", func(ctx context.Context, w http.ResponseWriter, r *http.Request) error {
		ts, _, err := a.jwtSrv.GenerateToken(staticClaims)
		if err != nil {
			return err
		}
		return httputil.NewPrinter(w, r).WriteString(http.StatusOK, ts)
	})
}
Esempio n. 2
0
func (a *app) setupStoreRoutes(rtr *ctxrouter.Router) {

	//	eg1 := e.Group(httputils.APIRoute.String(), a.jwtSrv.WithParseAndValidate())

	path := httputil.APIRoute.String() + store.RouteStores

	rtr.Handler("GET", path,
		ctxhttp.Chain(jsonStores, a.jwtSrv.WithParseAndValidate()),
	)

	//	eg1.Get(store.RouteStores, store.RESTStores(sm))
	//	eg1.POST(store.RouteStores, store.RESTStoreCreate)
	//	eg1.GET(store.RouteStore, store.RESTStore)
	//	eg1.PUT(store.RouteStore, store.RESTStoreSave)
	//	eg1.DELETE(store.RouteStore, store.RESTStoreDelete)
}