aboutsummaryrefslogtreecommitdiff
path: root/pkg/ext
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/ext')
-rw-r--r--pkg/ext/middleware.go8
1 files changed, 8 insertions, 0 deletions
diff --git a/pkg/ext/middleware.go b/pkg/ext/middleware.go
index c83b998..2dd1cca 100644
--- a/pkg/ext/middleware.go
+++ b/pkg/ext/middleware.go
@@ -92,6 +92,14 @@ func (a *AuthMiddleware) LoggedIn(next fasthttp.RequestHandler) fasthttp.Request
}
}
+func GetTokenFromCtx(ctx *fasthttp.RequestCtx) *Token {
+ tokenValue := ctx.UserValue("token")
+ if token, ok := tokenValue.(*Token); ok {
+ return token
+ }
+ return nil
+}
+
type InitialSetupMiddleware struct {
userRepository repository.UserRepository
}