Documentation
¶
Overview ¶
Package pagekit holds the shared design of the standalone pages that Giant Swarm services serve outside a product UI: sign-in results, device-code entry, consent and error pages.
The design sources (page layout, stylesheet, logos and wording) live in this repository next to this package, so the package can embed them and consumers ship the pages inside their own binaries, with nothing loaded at runtime. Consumers that are not Go programs, such as Dex, are meant to take the same sources as files.
Render writes a result page, such as the page a browser shows after a sign-in:
pagekit.Render(w, http.StatusOK, pagekit.Page{
Title: "Signed in to GitHub",
Heading: "Signed in",
Summary: "GitHub is now connected",
Message: "You can close this tab and return to Cursor.",
})
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func OAuthErrorCode ¶ added in v0.2.0
OAuthErrorCode returns code when it is an error code an authorization response may carry, such as access_denied or login_required, and "" for anything else. Anyone can send a browser to a callback with an error parameter of their choosing, so pass a callback's error through it before showing it, for example as Page.Detail, and log the raw value instead.
The known codes are those the IANA OAuth Extensions Error Registry lists for the authorization endpoint, plus invalid_target, which RFC 8707 registers for the implicit grant's error response.
Types ¶
type Page ¶
type Page struct {
// Title is the browser tab title, such as "Signed in to GitHub". It
// defaults to Heading.
Title string
// Heading is the outcome in a few words, such as "Signed in". It
// defaults to "Done", or "Something went wrong" for an error status.
Heading string
// Summary says what the outcome applies to, such as "GitHub is now
// connected".
Summary string
// Message says what to do next, such as "You can close this tab and
// return to Cursor."
Message string
// Detail is a technical hint for support, such as an error code. It is
// shown in monospace. Pass an OAuth callback's error parameter through
// OAuthErrorCode first.
Detail string
// Reference is a code the person can pass on to support, such as a
// request ID that also appears in the logs.
Reference string
}
Page is the content of a result page. All text is escaped, and every field is optional.