diff --git a/.idea/workspace.xml b/.idea/workspace.xml
index 1967ba0..9d9700a 100644
--- a/.idea/workspace.xml
+++ b/.idea/workspace.xml
@@ -4,10 +4,10 @@
-
+
-
+
@@ -160,7 +160,6 @@
-
@@ -185,7 +184,8 @@
-
+
+
diff --git a/pkg/internal/grpc/auth.go b/pkg/internal/grpc/auth.go
index 853908b..06107be 100644
--- a/pkg/internal/grpc/auth.go
+++ b/pkg/internal/grpc/auth.go
@@ -4,6 +4,7 @@ import (
"context"
"git.solsynth.dev/hypernet/nexus/pkg/nex"
"git.solsynth.dev/hypernet/passport/pkg/authkit/models"
+ "github.com/rs/zerolog/log"
"git.solsynth.dev/hypernet/passport/pkg/internal/services"
jsoniter "github.com/json-iterator/go"
@@ -13,13 +14,13 @@ import (
func (v *App) Authenticate(_ context.Context, in *proto.AuthRequest) (*proto.AuthReply, error) {
ticket, perms, err := services.Authenticate(uint(in.GetSessionId()))
+ log.Debug().Uint64("session", in.GetSessionId()).Any("permissions", perms).Msg("Authenticated session...")
if err != nil {
return &proto.AuthReply{
IsValid: false,
}, nil
} else {
user := ticket.Account
- user.PermNodes = perms
userinfo := &proto.UserInfo{
Id: uint64(user.ID),
Name: user.Name,
diff --git a/pkg/internal/services/auth.go b/pkg/internal/services/auth.go
index 21c29aa..e0fab17 100644
--- a/pkg/internal/services/auth.go
+++ b/pkg/internal/services/auth.go
@@ -24,6 +24,7 @@ func Authenticate(sessionId uint) (ctx models.AuthTicket, perms map[string]any,
_ = jsoniter.Unmarshal(rawHeldPerms, &heldPerms)
perms = FilterPermNodes(heldPerms, ctx.Claims)
+ ctx.Account.PermNodes = perms
return
}
@@ -45,7 +46,6 @@ func GetAuthContext(sessionId uint) (models.AuthTicket, error) {
key := GetAuthContextCacheKey(sessionId)
if val, err := marshal.Get(context.Background(), key, new(models.AuthTicket)); err == nil {
ctx = *val.(*models.AuthTicket)
- // log.Debug().Uint("session", sessionId).Msg("Hint auth context cache once")
} else {
ctx, err = CacheAuthContext(sessionId)
log.Debug().Uint("session", sessionId).Msg("Created a new auth context cache")