forked from authentricity/authentricity
23 lines
367 B
Go
23 lines
367 B
Go
package webui
|
|
|
|
import (
|
|
"encoding/json"
|
|
"net/http"
|
|
)
|
|
|
|
func (s *Service) debugTokenGet(w http.ResponseWriter, r *http.Request) {
|
|
if !requireLogin(w, r) {
|
|
return
|
|
}
|
|
|
|
tok := getUserToken(r.Context())
|
|
buf, err := json.MarshalIndent(tok, "", " ")
|
|
if err != nil {
|
|
s.renderError(w)
|
|
return
|
|
}
|
|
|
|
w.Header().Set("Content-Type", "application/json")
|
|
w.Write(buf)
|
|
}
|