MCPcopy
hub / github.com/smallstep/cli / badRequest

Method badRequest

command/oauth/cmd.go:1292–1324  ·  view source on GitHub ↗
(w http.ResponseWriter, msg string)

Source from the content-addressed store, hash-verified

1290}
1291
1292func (o *oauth) badRequest(w http.ResponseWriter, msg string) {
1293 w.WriteHeader(http.StatusBadRequest)
1294 w.Header().Add("Content-Type", "text/plain; charset=utf-8")
1295 w.Write([]byte(`<html lang="en-US">`))
1296 w.Write([]byte(`<head><title>OAuth Request Unsuccessful</title>`))
1297 w.Write([]byte(`</head>`))
1298 w.Write([]byte(`<body style='background-color: rgb(238, 246, 252);text-align:center;font-family: open sans, sans-serif; font-size: 22px; color: #333; width: 400px; margin: 0 auto; text-align: center; line-height: 1.7; padding: 20px;'>`))
1299 w.Write([]byte(`<div style="margin:auto;width:56px;">`))
1300 w.Write([]byte(`<svg width="56" height="61" viewBox="0 0 56 61" fill="none" xmlns="http://www.w3.org/2000/svg" style="alignment: center">`))
1301 w.Write([]byte(`<g filter="url(#filter0_d)">`))
1302 w.Write([]byte(`<path fill-rule="evenodd" clip-rule="evenodd" d="M50 38.0623L50 22.5532C50 20.0715 48.6641 17.77 46.4774 16.485L33.7817 9.02489C31.4569 7.65849 28.5431 7.65849 26.2183 9.02489L13.5226 16.485C11.3359 17.77 10 20.0715 10 22.5532L10 38.0623C10 40.544 11.3359 42.8455 13.5226 44.1305L26.2183 51.5909C28.5431 52.957 31.4569 52.957 33.7817 51.5909L46.4774 44.1305C48.6641 42.8455 50 40.544 50 38.0623Z" fill="white"/>`))
1303 w.Write([]byte(`</g>`))
1304 w.Write([]byte(`<path d="M26.1994 21.6989C26.5136 23.3294 28.3272 24.7249 28.9555 25.1068L35.8387 29.2344C36.5098 29.6164 40.3227 31.9813 41.7936 36.2852C41.8364 36.388 41.9364 36.4615 42.0363 36.4615C42.1791 36.4615 42.3077 36.344 42.3077 36.1824V24.5633C42.3077 23.917 41.9649 23.3147 41.408 23.0063L40.1085 22.2718C39.8372 22.1249 39.5087 22.2131 39.3516 22.4922L37.5523 25.7091C37.3952 25.9882 37.0525 26.0763 36.7812 25.9147L31.4689 22.7566C31.1976 22.595 31.1119 22.2424 31.269 21.9633L32.9969 18.8786C33.1682 18.5702 33.0397 18.1883 32.7256 18.056C32.1829 17.821 31.526 17.586 31.4689 17.5566C30.1123 17.1013 28.1987 16.9397 27.2848 18.3205C26.6421 19.2899 25.971 20.4651 26.1994 21.6989Z" fill="#DC4B40"/>`))
1305 w.Write([]byte(`<path d="M34.5697 38.9163C34.2555 37.2859 32.4419 35.8904 31.8136 35.5085L24.9304 31.3808C24.2593 30.9989 20.4464 28.634 18.9755 24.3301C18.9327 24.2273 18.8327 24.1538 18.7328 24.1538C18.5899 24.1538 18.4614 24.2713 18.4614 24.4329V36.0667C18.4614 36.713 18.8042 37.3152 19.3611 37.6237L20.6606 38.3582C20.9319 38.5051 21.2604 38.4169 21.4175 38.1378L23.2025 34.9209C23.3596 34.6418 23.7023 34.5537 23.9736 34.7153L29.2859 37.8734C29.5573 38.035 29.6429 38.3875 29.4859 38.6666L27.7722 41.7367C27.6009 42.0451 27.7294 42.427 28.0435 42.5592C28.5862 42.7943 29.2431 43.0293 29.3002 43.0587C30.6426 43.514 32.5561 43.6756 33.4701 42.2948C34.127 41.3254 34.7982 40.1502 34.5697 38.9163Z" fill="#DC4B40"/>`))
1306 w.Write([]byte(`<defs>`))
1307 w.Write([]byte(`<filter id="filter0_d" x="0" y="0" width="56" height="60.6154" filterUnits="userSpaceOnUse" color-interpolation-filters="sRGB">`))
1308 w.Write([]byte(`<feFlood flood-opacity="0" result="BackgroundImageFix"/>`))
1309 w.Write([]byte(`<feColorMatrix in="SourceAlpha" type="matrix" values="0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 127 0"/>`))
1310 w.Write([]byte(`<feOffset dx="-2"/>`))
1311 w.Write([]byte(`<feGaussianBlur stdDeviation="4"/>`))
1312 w.Write([]byte(`<feColorMatrix type="matrix" values="0 0 0 0 0.13245 0 0 0 0 0.185971 0 0 0 0 0.444462 0 0 0 0.211532 0"/>`))
1313 w.Write([]byte(`<feBlend mode="normal" in2="BackgroundImageFix" result="effect1_dropShadow"/>`))
1314 w.Write([]byte(`<feBlend mode="normal" in="SourceGraphic" in2="effect1_dropShadow" result="shape"/>`))
1315 w.Write([]byte(`</filter>`))
1316 w.Write([]byte(`</defs>`))
1317 w.Write([]byte(`</svg>`))
1318 w.Write([]byte(`</div>`))
1319 w.Write([]byte(`<p style='font-size: 20px;'>`))
1320 w.Write([]byte(`<strong style='font-size: 28px; color: red;'>Failure</strong><br />`))
1321 w.Write([]byte(msg)) // #nosec G705 -- message is either a string literal, or comes from (trusted) IdP
1322 w.Write([]byte(`</p></body></html>`))
1323 o.errCh <- errors.New(msg)
1324}

Callers 2

ServeHTTPMethod · 0.95
implicitHandlerMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected