func (app *router) sessionDelIntercept(ctx *bear.Context) { sessionID := ctx.Get(forest.SessionID).(string) if sessionID == sessionIDWithSelfDestruct { ctx.Set(forest.SessionID, nil) } if sessionID == sessionIDWithUserDestruct { ctx.Set(forest.SessionUserID, nil) } ctx.Next() }
func (app *router) sessionVerify(ctx *bear.Context) { _, ok := ctx.Get(forest.SessionID).(string) if !ok { ctx.Set(forest.Error, errors.New("sessionVerify failed")) app.Ware("ServerError")(ctx) return } else { ctx.Next() } }
func (app *router) authenticate(ctx *bear.Context) { ctx.Set(forest.SessionID, sessionIDExistent) ctx.Set(forest.SessionUserID, sessionUserID) ctx.Next() }