package handlers import ( "encoding/json" "net/http" "forge-mesh/internal/auth" ) // AuthHandlers serves login and WS ticket endpoints. type AuthHandlers struct { Tickets *auth.TicketStore } func (h *AuthHandlers) WSTicket(w http.ResponseWriter, r *http.Request) { if r.Method != http.MethodPost { http.Error(w, "method not allowed", http.StatusMethodNotAllowed) return } ticket, err := h.Tickets.Issue() if err != nil { http.Error(w, "ticket error", http.StatusInternalServerError) return } w.Header().Set("Content-Type", "application/json") _ = json.NewEncoder(w).Encode(map[string]string{"ticket": ticket}) }