mirror of
https://tangled.org/evan.jarrett.net/at-container-registry
synced 2026-09-20 09:14:16 +00:00
we only use service tokens now
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user