feat: add assessment, privacy and support flows
This commit is contained in:
1 parent
ee3738ee73
commit
e4f24fa202
339 files changed
+56454
-1126
No files matched your search
@@ -79,7 +79,7 @@ func NewRouter(
|
||||
// server aborts the response; the kit Recoverer would swallow that panic.
|
||||
router.Group(func(public chi.Router) {
|
||||
public.Use(problems.Recover)
|
||||
public.Handle(apiWildcard, clearUnauthorizedLogoutCookie(apiServer))
|
||||
public.Handle(apiWildcard, clearUnauthorizedLogoutCookie(limitOperationBody(apiServer)))
|
||||
// Unknown /api paths outside the versioned prefix are also problems,
|
||||
// so every error under /api has the contract's format.
|
||||
public.Handle(apiRoot, http.HandlerFunc(problems.NotFound))
|
||||
@@ -88,6 +88,16 @@ func NewRouter(
|
||||
return router, nil
|
||||
}
|
||||
|
||||
func limitOperationBody(server *apiadapter.Server) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
operation, found := server.FindPath(r.Method, r.URL)
|
||||
if found && operation.PathPattern() == publicPrefix+"/me/assessment-attempts/{attempt_id}/signals" {
|
||||
limitAssessmentSignalBody(w, r)
|
||||
}
|
||||
server.ServeHTTP(w, r)
|
||||
})
|
||||
}
|
||||
|
||||
func clearUnauthorizedLogoutCookie(next http.Handler) http.Handler {
|
||||
return http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
|
||||
clearCookie := r.Method == http.MethodDelete && r.URL.Path == publicPrefix+"/identity/sessions/current"
|
||||
|
||||
Reference in new issue
Block a user