feat(server): add /api/v1/session endpoint
All checks were successful
arcad/emissary/pipeline/head This commit looks good

This commit is contained in:
2024-03-03 18:40:56 +01:00
parent 8f2131338d
commit 76718722cc
5 changed files with 75 additions and 7 deletions

View File

@ -1,6 +1,7 @@
package agent
import (
"encoding/json"
"fmt"
"forge.cadoles.com/Cadoles/emissary/internal/auth"
@ -29,4 +30,18 @@ func (u *User) Agent() *datastore.Agent {
return u.agent
}
func (u *User) MarshalJSON() ([]byte, error) {
type user struct {
Subject string `json:"subject"`
Tenant string `json:"tenant"`
}
jsonUser := user{
Subject: u.Subject(),
Tenant: string(u.Tenant()),
}
return json.Marshal(jsonUser)
}
var _ auth.User = &User{}