feat: extract tags from tailscale node

This commit is contained in:
Stavros
2026-05-10 19:23:34 +03:00
parent 8fad270379
commit 8b28e0c3e4
5 changed files with 6 additions and 2 deletions
+1 -1
View File
@@ -160,7 +160,6 @@ func (m *ContextMiddleware) cookieAuth(ctx context.Context, uuid string, ip stri
if userContext.Local.Attributes.Email == "" {
userContext.Local.Attributes.Email = utils.CompileUserEmail(user.Username, m.runtime.CookieDomain)
}
// Ensures that the seesion is still coming from Tailscale
case model.ProviderTailscale:
tailscaleContext, err := m.tailscaleWhois(ctx, ip)
@@ -313,6 +312,7 @@ func (m *ContextMiddleware) tailscaleWhois(ctx context.Context, ip string) (*mod
Name: whois.DisplayName,
},
UserID: whois.UserID,
Tags: whois.Tags,
}
if !strings.ContainsAny(uctx.Email, "@") {
+1
View File
@@ -241,6 +241,7 @@ type TailscaleWhoisResponse struct {
LoginName string
DisplayName string
NodeName string
Tags []string
}
type Apps struct {
+2
View File
@@ -59,6 +59,8 @@ type LDAPContext struct {
type TailscaleContext struct {
BaseContext
UserID string
// for future use
Tags []string
}
func (c *UserContext) IsAuthenticated() bool {
+1
View File
@@ -100,6 +100,7 @@ func (ts *TailscaleService) Whois(ctx context.Context, addr string) (*model.Tail
LoginName: who.UserProfile.LoginName,
DisplayName: who.UserProfile.DisplayName,
NodeName: strings.TrimSuffix(who.Node.Name, "."),
Tags: who.Node.Tags,
}
return &res, nil