csrf

package
v1.33.0 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package csrf provides the CSRF cookie and token helpers shared by the OAuth login and consent flows. Each flow owns a Cookie under its own name; the cookie attributes and token validation are identical across flows.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMismatch = errors.New("csrf token mismatch")
	ErrNoCookie = errors.New("csrf cookie missing")
)

Functions

func ValidateToken

func ValidateToken(expected, provided string) error

Types

type Cookie struct {
	// contains filtered or unexported fields
}

func NewCookie

func NewCookie(name string) Cookie

func (Cookie) Clear

func (c Cookie) Clear(w http.ResponseWriter)

func (Cookie) Read

func (c Cookie) Read(r *http.Request) (string, error)

func (Cookie) Set

func (c Cookie) Set(w http.ResponseWriter, token string) error

Jump to

Keyboard shortcuts

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