request

package
v0.0.0-...-a84335b Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2024 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package request provides helpers and access methods for working with http requests

Index

Constants

View Source
const (
	ProfileIDContextKey contextKey = iota
	ProfileNameContextKey
	IsAuthenticatedContextKey
	SessionIDContextKey
	RequestIDContextKey
)
View Source
const (
	// UserSessionCookieKey is the name for user session cookies
	UserSessionCookieKey string = "SelfsterUserSession"
)

Variables

This section is empty.

Functions

func ClientIP

func ClientIP(r *http.Request) string

ClientIP will attempt to find the end-user's ip address from the request. This will first check for headers indicating the source ip and then the request remote address if no headers are found.

TODO (james): compare remote address to a configured trusted proxy range, only trust Forwarded-For headers when trusted proxy is involved.

func ExpiredCookie

func ExpiredCookie(name string, isHTTPS bool, path string) *http.Cookie

ExpiredCookie creates an expired cookie. Used to drop the cookie state with the given name

func ID

func ID(r *http.Request) string

ID retreives the request ID from the given request

func IsAuthenticated

func IsAuthenticated(r *http.Request) bool

IsAuthenticated indicates if the request has passed authentication

func NewCookie

func NewCookie(name, value string, isHTTPS bool, path string) *http.Cookie

NewCookie creates a new cookie with the given name and value

func ProfileID

func ProfileID(r *http.Request) string

ProfileID returns the authenticated profile id from the given request

func ProfileName

func ProfileName(r *http.Request) string

ProfileName returns the profile name from the given request

func SessionID

func SessionID(r *http.Request) string

SessionID returns the login session identifier from the given request

Types

This section is empty.

Directories

Path Synopsis
Package binding provides functions for binding input to internal parameter structures and verifying those bindings.
Package binding provides functions for binding input to internal parameter structures and verifying those bindings.

Jump to

Keyboard shortcuts

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