Documentation
¶
Index ¶
- Constants
- Variables
- func ExposesBeyondLoopback(listenAddr string) bool
- func HasAllowedOrigins(origins []string) bool
- func ValidateRemoteExposure(listenAddr, token string) error
- type CookieSecurePolicy
- type Guard
- func (g *Guard) CheckOrigin(r *http.Request) error
- func (g *Guard) ClearAuthCookie(w http.ResponseWriter, r *http.Request)
- func (g *Guard) RequireAuth(r *http.Request) error
- func (g *Guard) SetAuthCookie(w http.ResponseWriter, r *http.Request)
- func (g *Guard) TokenMatches(token string) bool
- func (g *Guard) TokenRequired() bool
Constants ¶
View Source
const AuthCookieName = "sentinel_auth"
Variables ¶
View Source
var ( ErrOriginDenied = errors.New("origin denied") ErrRemoteToken = errors.New("token is required for non-loopback listen address") )
Functions ¶
func ExposesBeyondLoopback ¶ added in v0.3.11
ExposesBeyondLoopback reports whether listenAddr is reachable from outside the host.
func HasAllowedOrigins ¶ added in v0.3.11
HasAllowedOrigins reports whether at least one non-empty origin is configured.
func ValidateRemoteExposure ¶ added in v0.3.10
ValidateRemoteExposure enforces the minimum security baseline when Sentinel is configured to listen on a non-loopback address.
Types ¶
type CookieSecurePolicy ¶ added in v0.3.12
type CookieSecurePolicy int
CookieSecurePolicy controls the Secure flag on auth cookies.
const ( // CookieSecureAuto sets Secure based on per-request TLS detection. CookieSecureAuto CookieSecurePolicy = iota // CookieSecureAlways forces the Secure flag regardless of transport. CookieSecureAlways // CookieSecureNever omits the Secure flag regardless of transport. CookieSecureNever )
func ParseCookieSecurePolicy ¶ added in v0.3.12
func ParseCookieSecurePolicy(s string) CookieSecurePolicy
ParseCookieSecurePolicy converts a config string to a CookieSecurePolicy.
type Guard ¶
type Guard struct {
// contains filtered or unexported fields
}
func (*Guard) ClearAuthCookie ¶ added in v0.3.12
func (g *Guard) ClearAuthCookie(w http.ResponseWriter, r *http.Request)
func (*Guard) SetAuthCookie ¶ added in v0.3.12
func (g *Guard) SetAuthCookie(w http.ResponseWriter, r *http.Request)
func (*Guard) TokenMatches ¶ added in v0.3.12
func (*Guard) TokenRequired ¶
Click to show internal directories.
Click to hide internal directories.