summaryrefslogtreecommitdiff
path: root/nexus/utils/shortcuts/token.go
diff options
context:
space:
mode:
Diffstat (limited to 'nexus/utils/shortcuts/token.go')
-rw-r--r--nexus/utils/shortcuts/token.go16
1 files changed, 16 insertions, 0 deletions
diff --git a/nexus/utils/shortcuts/token.go b/nexus/utils/shortcuts/token.go
new file mode 100644
index 0000000..be9990f
--- /dev/null
+++ b/nexus/utils/shortcuts/token.go
@@ -0,0 +1,16 @@
+package shortcuts
+
+import (
+ "strings"
+
+ "github.com/gofiber/fiber/v2"
+)
+
+func BearerToken(context *fiber.Ctx) string {
+ authHeader := context.Get("Authorization")
+ parts := strings.SplitN(authHeader, " ", 2)
+ if len(parts) != 2 || parts[0] != "Bearer" {
+ return ""
+ }
+ return parts[1]
+}