Documentation
¶
Index ¶
- type Std
- func (s *Std) GetConfig(pattern string) (*csrf.Config, bool)
- func (s *Std) Middleware() func(http.Handler) http.Handler
- func (s *Std) SetConfig(pattern string, config *csrf.Config)
- func (s *Std) TokenHandler(w http.ResponseWriter, r *http.Request, method, path string, ...) (string, error)
- func (s *Std) WrapHandler(handler http.HandlerFunc) http.HandlerFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Std ¶
type Std struct {
// contains filtered or unexported fields
}
func (*Std) Middleware ¶
Middleware 中间件 在接口运行过程中 实时查询csrf配置信息,并进行验证
func (*Std) TokenHandler ¶
func (s *Std) TokenHandler(w http.ResponseWriter, r *http.Request, method, path string, config *csrf.Config) (string, error)
TokenHandler 设置csrf token 前端调用的时候,切记不能每个接口都访问前都访问这个接口,否则会重复设置cookie,导致csrf验证失败。 根据接口的安全程度来设置调用频率即可。
func (*Std) WrapHandler ¶
func (s *Std) WrapHandler(handler http.HandlerFunc) http.HandlerFunc
WrapHandler 包装单个处理器 csrf配置信息,一般时固定好了后不会再改变。
Click to show internal directories.
Click to hide internal directories.