redirect

package
v0.1.23 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 26, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const ReturnToQueryParam = "return_to"

Variables

This section is empty.

Functions

func AudienceForPath

func AudienceForPath(path string) token.Audience

func AudienceFromRequest

func AudienceFromRequest(r *http.Request) (token.Audience, error)

func IsSafeReturnTo

func IsSafeReturnTo(v string) bool

IsSafeReturnTo reports whether the provided value is a safe relative redirect path.

func NormalizeReturnTo

func NormalizeReturnTo(v string) (string, bool)

NormalizeReturnTo validates the value and returns the normalized redirect target. If the value is invalid it returns ("", false).

func QueryParam

func QueryParam(r *http.Request) string

QueryParam returns the raw return_to query parameter value.

func Redirect

func Redirect(w http.ResponseWriter, r *http.Request, location string, status int)

func WithReturnTo

func WithReturnTo(path string, returnTo string) string

WithReturnTo builds a URL like:

/auth/login?return_to=%2Fauth%2Faccount

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL