Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func WithRequestContext ¶
func WithRequestContext(ctx context.Context, requestContext RequestContext) context.Context
Types ¶
type Guard ¶
type Guard interface {
Evaluate(r *http.Request) (RequestContext, OriginDecision, error)
ValidateCSRF(r *http.Request, sessionHash string) error
}
type OriginDecision ¶
type OriginDecision string
const ( OriginTrustedParent OriginDecision = "trusted_parent" OriginDeny OriginDecision = "deny" )
type RequestContext ¶
type RequestContext struct {
Origin string `json:"origin"`
Route string `json:"route"`
Method string `json:"method"`
Scope RequestScope `json:"scope"`
}
func RequestContextFromContext ¶
func RequestContextFromContext(ctx context.Context) (RequestContext, bool)
type RequestScope ¶
type RequestScope struct {
OwnerSessionHash string `json:"owner_session_hash"`
OwnerUserHash string `json:"owner_user_hash,omitempty"`
SessionChannelIDHash string `json:"session_channel_id_hash"`
}
func (RequestScope) Valid ¶
func (s RequestScope) Valid() bool
Click to show internal directories.
Click to hide internal directories.