Documentation ¶
Overview ¶
Package page provides middleware and handlers for root-level pages.
Index ¶
- Constants
- Variables
- func AuthRedirect(logger Logger, sessionStore SessionStore) http.HandlerFunc
- func CacheControlHeaders(h http.Handler) http.Handler
- func CookieConsent() http.HandlerFunc
- func DependencyHealthCheck(services map[string]HealthChecker) http.HandlerFunc
- func PostFormReferenceNumber(r *http.Request, name string) string
- func PostFormString(r *http.Request, name string) string
- func Recover(tmpl template.Template, logger Logger, bundle Bundle, next http.Handler) http.HandlerFunc
- func ValidateCsrf(next http.Handler, store SessionStore, randomString func(int) string, ...) http.HandlerFunc
- type Bundle
- type DashboardStore
- type DonorStore
- type ErrorHandler
- type EventClient
- type HandleOpt
- type Handler
- func Dashboard(tmpl template.Template, donorStore DonorStore, dashboardStore DashboardStore, ...) Handler
- func Guidance(tmpl template.Template) Handler
- func Login(oneLoginClient LoginOneLoginClient, sessionStore LoginSessionStore, ...) Handler
- func LoginCallback(logger Logger, oneLoginClient LoginCallbackOneLoginClient, ...) Handler
- func Root(tmpl template.Template, logger Logger) Handler
- func SignOut(logger Logger, sessionStore SessionStore, oneLoginClient OneLoginClient, ...) Handler
- type HealthChecker
- type Localizer
- type Logger
- type LoginCallbackOneLoginClient
- type LoginCallbackSessionStore
- type LoginOneLoginClient
- type LoginSessionStore
- type OneLoginClient
- type Path
- type SessionStore
- type ShareCodeStore
- type Template
Constants ¶
View Source
const ( PathAttorneyConfirmDontWantToBeAttorneyLoggedOut = Path("/confirm-you-do-not-want-to-be-an-attorney") PathAttorneyEnterReferenceNumber = Path("/attorney-enter-reference-number") PathAttorneyEnterReferenceNumberOptOut = Path("/attorney-enter-reference-number-opt-out") PathAttorneyLogin = Path("/attorney-login") PathAttorneyLoginCallback = Path("/attorney-login-callback") PathAttorneyStart = Path("/attorney-start") PathAttorneyYouHaveDecidedNotToBeAttorney = Path("/you-have-decided-not-to-be-an-attorney") PathCertificateProviderConfirmDontWantToBeCertificateProviderLoggedOut = Path("/confirm-you-do-not-want-to-be-a-certificate-provider") PathCertificateProviderEnterReferenceNumber = Path("/certificate-provider-enter-reference-number") PathCertificateProviderEnterReferenceNumberOptOut = Path("/certificate-provider-enter-reference-number-opt-out") PathCertificateProviderLogin = Path("/certificate-provider-login") PathCertificateProviderLoginCallback = Path("/certificate-provider-login-callback") PathCertificateProviderYouHaveDecidedNotToBeCertificateProvider = Path("/you-have-decided-not-to-be-a-certificate-provider") PathHealthCheckDependency = Path("/health-check/dependency") PathHealthCheckService = Path("/health-check/service") PathSupporterEnterOrganisationName = Path("/enter-the-name-of-your-organisation-or-company") PathSupporterEnterReferenceNumber = Path("/supporter-reference-number") PathSupporterEnterYourName = Path("/enter-your-name") PathSupporterInviteExpired = Path("/invite-expired") PathSupporterLogin = Path("/supporter-login") PathSupporterLoginCallback = Path("/supporter-login-callback") PathSupporterOrganisationDeleted = Path("/organisation-deleted") PathSupporterSigningInAdvice = Path("/signing-in-with-govuk-one-login") PathSupporterStart = Path("/supporter-start") PathVoucherStart = Path("/voucher-start") PathVoucherLogin = Path("/voucher-login") PathVoucherLoginCallback = Path("/voucher-login-callback") PathVoucherEnterReferenceNumber = Path("/voucher-enter-reference-number") PathVoucherUnableToConfirmIdentity = Path("/voucher-unable-to-confirm-identity") PathAttorneyFixtures = Path("/fixtures/attorney") PathAuthRedirect = Path("/auth/redirect") PathCertificateProviderFixtures = Path("/fixtures/certificate-provider") PathCertificateProviderStart = Path("/certificate-provider-start") PathCookiesConsent = Path("/cookies-consent") PathDashboard = Path("/dashboard") PathDashboardFixtures = Path("/fixtures/dashboard") PathEnterAccessCode = Path("/enter-access-code") PathFixtures = Path("/fixtures") PathLogin = Path("/login") PathLoginCallback = Path("/login-callback") PathLpaDeleted = Path("/lpa-deleted") PathLpaWithdrawn = Path("/lpa-withdrawn") PathRoot = Path("/") PathSignOut = Path("/sign-out") PathStart = Path("/start") PathSupporterFixtures = Path("/fixtures/supporter") PathVoucherFixtures = Path("/fixtures/voucher") )
View Source
const FormUrlEncoded = "application/x-www-form-urlencoded"
Variables ¶
View Source
var ErrCsrfInvalid = errors.New("CSRF token not valid")
Functions ¶
func AuthRedirect ¶
func AuthRedirect(logger Logger, sessionStore SessionStore) http.HandlerFunc
func CookieConsent ¶
func CookieConsent() http.HandlerFunc
func DependencyHealthCheck ¶
func DependencyHealthCheck(services map[string]HealthChecker) http.HandlerFunc
func ValidateCsrf ¶
func ValidateCsrf(next http.Handler, store SessionStore, randomString func(int) string, errorHandler ErrorHandler) http.HandlerFunc
Types ¶
type DashboardStore ¶
type DonorStore ¶
type ErrorHandler ¶
type ErrorHandler func(http.ResponseWriter, *http.Request, error)
type EventClient ¶ added in v0.962.0
type EventClient interface { SendNotificationSent(ctx context.Context, notificationSentEvent event.NotificationSent) error SendPaperFormRequested(ctx context.Context, paperFormRequestedEvent event.PaperFormRequested) error }
type Handler ¶
type Handler func(data appcontext.Data, w http.ResponseWriter, r *http.Request) error
func Dashboard ¶
func Dashboard(tmpl template.Template, donorStore DonorStore, dashboardStore DashboardStore, useURL string) Handler
func Login ¶
func Login(oneLoginClient LoginOneLoginClient, sessionStore LoginSessionStore, randomString func(int) string, redirect Path) Handler
func LoginCallback ¶
func LoginCallback(logger Logger, oneLoginClient LoginCallbackOneLoginClient, sessionStore LoginCallbackSessionStore, redirect Path, dashboardStore DashboardStore, actorType actor.Type) Handler
func SignOut ¶
func SignOut(logger Logger, sessionStore SessionStore, oneLoginClient OneLoginClient, appPublicURL string) Handler
type HealthChecker ¶ added in v0.805.0
type Localizer ¶
type Localizer interface { Concat(list []string, joiner string) string Count(messageID string, count int) string Format(messageID string, data map[string]interface{}) string FormatCount(messageID string, count int, data map[string]any) string FormatDate(t date.TimeOrDate) string FormatTime(t time.Time) string FormatDateTime(t time.Time) string Possessive(s string) string SetShowTranslationKeys(s bool) ShowTranslationKeys() bool T(messageID string) string }
type LoginCallbackSessionStore ¶ added in v0.1051.0
type LoginCallbackSessionStore interface { OneLogin(r *http.Request) (*sesh.OneLoginSession, error) SetLogin(r *http.Request, w http.ResponseWriter, session *sesh.LoginSession) error }
type LoginOneLoginClient ¶
type LoginSessionStore ¶ added in v0.1051.0
type LoginSessionStore interface {
SetOneLogin(r *http.Request, w http.ResponseWriter, session *sesh.OneLoginSession) error
}
type OneLoginClient ¶
type OneLoginClient interface { AuthCodeURL(state, nonce, locale string, identity bool) (string, error) EndSessionURL(idToken, postLogoutURL string) (string, error) Exchange(ctx context.Context, code, nonce string) (idToken, accessToken string, err error) UserInfo(ctx context.Context, accessToken string) (onelogin.UserInfo, error) }
type Path ¶
type Path string
func (Path) Redirect ¶ added in v0.833.0
func (p Path) Redirect(w http.ResponseWriter, r *http.Request, appData appcontext.Data) error
func (Path) RedirectQuery ¶ added in v0.833.0
func (p Path) RedirectQuery(w http.ResponseWriter, r *http.Request, appData appcontext.Data, query url.Values) error
type SessionStore ¶
type SessionStore interface { Csrf(r *http.Request) (*sesh.CsrfSession, error) SetCsrf(r *http.Request, w http.ResponseWriter, session *sesh.CsrfSession) error Login(r *http.Request) (*sesh.LoginSession, error) SetLogin(r *http.Request, w http.ResponseWriter, session *sesh.LoginSession) error ClearLogin(r *http.Request, w http.ResponseWriter) error OneLogin(r *http.Request) (*sesh.OneLoginSession, error) SetOneLogin(r *http.Request, w http.ResponseWriter, session *sesh.OneLoginSession) error }
type ShareCodeStore ¶
type ShareCodeStore interface {}
Source Files ¶
Click to show internal directories.
Click to hide internal directories.