You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This document describes the error page system implemented in the auth0-cas-server-go service. The system provides user-friendly HTML error pages with embedded CSS styling, while maintaining fallback support for plain text errors. The system differentiates between user-facing routes and CAS protocol routes.
6
+
7
+
## Architecture
8
+
9
+
1.**HTML Template** (`templates/error.html`): Responsive error page template with embedded CSS styling and conditional "Go Back" button
10
+
2.**Error Wrapper Functions** (`responses.go`): Template rendering with different behaviors for user vs callback routes
11
+
3.**CAS Protocol Error Handler**: Uses existing `outputFailure` function for XML/JSON responses
@@ -104,17 +104,17 @@ func casLogin(w http.ResponseWriter, r *http.Request) {
104
104
session, _:=store.Get(r, "cas-shim")
105
105
session.Values[state] =service
106
106
err=session.Save(r, w)
107
-
iferr!=nil&&err.Error()=="securecookie: the value is too long" {
107
+
iferr!=nil&&strings.HasPrefix(err.Error(), "securecookie: the value is too long") {
108
108
// The cookie can get too big if the user tries 10+ logins in the day
109
109
// without returning from any of them.
110
-
appLogger(r.Context()).Warn("cookie too large (bot or other bad client)")
110
+
appLogger(r.Context()).Warn("cookie too large", "error", err)
111
111
w.Header().Set("Retry-After", "86400")
112
-
http.Error(w, "429 too many requests", http.StatusTooManyRequests)
112
+
renderUserErrorPage(r.Context(), w, http.StatusTooManyRequests, "Session size limit reached. Either the URL you are logging into is too long, or you had too many unsuccessful logins in the last 24 hours.")
0 commit comments