csrf

package
v1.123.2-rc Latest Latest
Warning

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

Go to latest
Published: Feb 20, 2025 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const CookieName = "csrf_token"

CookieName is the name of the cookie storing the CSRF token.

Variables

This section is empty.

Functions

This section is empty.

Types

type Service

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

Service provides security token generation and CSRF cookie setting.

func NewService

func NewService(signer consoleauth.Signer) *Service

NewService creates a new CSRF service.

func (*Service) GenerateSecurityToken

func (s *Service) GenerateSecurityToken() (string, error)

GenerateSecurityToken generates a random signed security token.

func (*Service) SetCookie

func (s *Service) SetCookie(w http.ResponseWriter) error

SetCookie sets parametrized CSRF cookie that is not accessible from js.

Jump to

Keyboard shortcuts

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