timon_playgroud/tools/auth.go

31 lines
500 B
Go

package tools
import (
"context"
"github.com/labstack/echo/v4"
)
const (
UserCtxKey = "user"
LpCtxKey = "lp"
DomainCtxKey = "domain"
RootCtxKey = "rootCtx"
)
func GetUser(c echo.Context) string {
return c.Get(UserCtxKey).(string)
}
func GetDomain(c echo.Context) string {
return c.Get(DomainCtxKey).(string)
}
func GetLp(c echo.Context) string {
return c.Get(LpCtxKey).(string)
}
func GetRootCtx(c echo.Context) context.Context {
return c.Get(RootCtxKey).(context.Context)
}