we only use service tokens now

This commit is contained in:
Evan Jarrett
2025-10-25 00:37:46 -05:00
parent f75d9ceafb
commit e2d65c627f
+4 -3
View File
@@ -120,10 +120,11 @@ func (h *XRPCHandler) requireOwnerOrCrewAdmin(next http.Handler) http.Handler {
// Stores validated user in request context
func (h *XRPCHandler) requireAuth(next http.Handler) http.Handler {
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
user, err := ValidateDPoPRequest(r, h.httpClient)
// Service token authentication
user, err := ValidateServiceToken(r, h.pds.did, h.httpClient)
if err != nil {
http.Error(w, fmt.Sprintf("authentication failed: %v", err), http.StatusUnauthorized)
return
http.Error(w, fmt.Sprintf("unauthorized: %v", err), http.StatusForbidden)
return
}
// Store user in context for handlers to access
ctx := context.WithValue(r.Context(), contextKeyUser, user)