Documentation ¶
Overview ¶
Package request provides helpers and access methods for working with http requests
Index ¶
- Constants
- func ClientIP(r *http.Request) string
- func ExpiredCookie(name string, isHTTPS bool, path string) *http.Cookie
- func ID(r *http.Request) string
- func IsAuthenticated(r *http.Request) bool
- func NewCookie(name, value string, isHTTPS bool, path string) *http.Cookie
- func ProfileID(r *http.Request) string
- func ProfileName(r *http.Request) string
- func SessionID(r *http.Request) string
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 ¶
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 ¶
ExpiredCookie creates an expired cookie. Used to drop the cookie state with the given name
func IsAuthenticated ¶
IsAuthenticated indicates if the request has passed authentication
func ProfileName ¶
ProfileName returns the profile name from the given request
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.