INNER CODE UNIT · Go

zeroTrustChallengeNeeded

netgoat-xyz/netgoat · main.go:1294

func zeroTrustChallengeNeeded(store *challenge.Store, r *http.Request, result *auth.AuthResult, globalEnabled bool, binding challenge.SessionBinding) bool {
	return auth.RequireZeroTrustChallenge(result, globalEnabled, store.Satisfied(r, binding))
}

func writeChallengeResponse(w http.ResponseWriter, r *http.Request, ch *challenge.Challenge, status int, fallback string) {
	if challenge.WantsJSON(r) {
		w.Header().Set("Content-Type", "application/json")
		w.WriteHeader(status)
		_, _ = w.Write(challenge.RenderChallengeJSON(ch, status, fallback))
		return
	}
	html := challenge.RenderDynamicErrorPage(ch, status, fallback)
	w.Header().Set("Content-Type", "text/html; charset=utf-8")
	w.WriteHeader(status)
	_, _ = w.Write([]byte(html))
}

func challengeDifficulty(ch *challenge.Challenge) int {

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…