browsercookie

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jul 25, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package browsercookie extracts browser cookies for Canvas authentication.

Index

Constants

This section is empty.

Variables

View Source
var ErrNoSessionCookie = errors.New("no session cookie found for host")

ErrNoSessionCookie is returned when no session cookie is found for the host.

Functions

func AvailableBrowsers

func AvailableBrowsers() []string

AvailableBrowsers returns browser names supported on the current OS.

func ExtractCookies

func ExtractCookies(ctx context.Context, host string) (sessionCookie, csrfToken string, err error)

ExtractCookies reads Canvas cookies for host. It filters by exact host match

func ExtractCookiesForBrowser

func ExtractCookiesForBrowser(ctx context.Context, host, browserName string) (sessionCookie, csrfToken string, err error)

ExtractCookiesForBrowser is like ExtractCookies but restricted to a single

func IsCSRFCookie

func IsCSRFCookie(cookie *http.Cookie) bool

IsCSRFCookie reports whether cookie is the Canvas CSRF token cookie.

func IsSessionCookie

func IsSessionCookie(cookie *http.Cookie) bool

IsSessionCookie reports whether cookie is a known Canvas session cookie.

Types

type CookieReader

type CookieReader interface {
	ReadCookies(ctx context.Context, filters ...kooky.Filter) (kooky.Cookies, error)
}

CookieReader abstracts cookie reading for testability.

var Reader CookieReader = &DefaultReader{}

Reader is the package-level cookie reader, overridable for dependency injection.

type DefaultReader added in v0.4.0

type DefaultReader struct{}

func (*DefaultReader) ReadCookies added in v0.4.0

func (r *DefaultReader) ReadCookies(ctx context.Context, filters ...kooky.Filter) (kooky.Cookies, error)

Jump to

Keyboard shortcuts

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