use builtin error interface for http handlers
1 file changed, 5 insertions(+), 5 deletions(-)
changed files
M domain/content/publisher/mux.go → domain/content/publisher/mux.go
@@ -31,7 +31,7 @@ ErrCannotDetermineUser = ihttp.NewError("cannot determine user", http.StatusInternalServerError) ErrRenderFailure = ihttp.NewError("failed to render page", http.StatusInternalServerError) ) -func (s *Service) Index(w http.ResponseWriter, r *http.Request) ihttp.Error { +func (s *Service) Index(w http.ResponseWriter, r *http.Request) error { userName := "Guest" isLoggedIn := false if user, err := getUserFromRequest(r); err == nil {@@ -62,7 +62,7 @@ // Login initiates the OIDC authentication flow with PKCE S256. // PKCE (Proof Key for Code Exchange) protects against authorization code interception attacks // by using a cryptographically random verifier and its SHA256 hash challenge. // See: https://www.rfc-editor.org/rfc/rfc7636 -func (s *Service) Login(w http.ResponseWriter, r *http.Request) ihttp.Error { +func (s *Service) Login(w http.ResponseWriter, r *http.Request) error { // Generate random state for CSRF protection state, err := generateRandomState() if err != nil {@@ -106,7 +106,7 @@ // Callback handles the OIDC provider's redirect after authentication. // It verifies the state parameter (CSRF protection), exchanges the authorization code // for tokens using the PKCE verifier, validates the ID token, and creates a session. -func (s *Service) Callback(w http.ResponseWriter, r *http.Request) ihttp.Error { +func (s *Service) Callback(w http.ResponseWriter, r *http.Request) error { ctx := r.Context() // Verify state parameter (CSRF protection)@@ -212,7 +212,7 @@ return nil } -func (s *Service) Logout(w http.ResponseWriter, r *http.Request) ihttp.Error { +func (s *Service) Logout(w http.ResponseWriter, r *http.Request) error { // Clear session cookie http.SetCookie(w, &http.Cookie{ Name: sessionCookieName,@@ -263,7 +263,7 @@ return base64.URLEncoding.EncodeToString(b), nil } -func (s *Service) Style(w http.ResponseWriter, r *http.Request) ihttp.Error { +func (s *Service) Style(w http.ResponseWriter, r *http.Request) error { w.Header().Set("Content-Type", "text/css") http.ServeFileFS(w, r, basetpl.Files, "style.css")