Documentation
¶
Overview ¶
Copyright (c) 2021 rookie-ninja
Use of this source code is governed by an Apache-style license that can be found in the LICENSE file.
Package rkgrpccsrf is a CSRF interceptor for grpc framework
Index ¶
- func Interceptor(h http.Handler, opts ...Option) http.Handler
- type Option
- func WithCookieDomain(val string) Option
- func WithCookieHTTPOnly(val bool) Option
- func WithCookieMaxAge(val int) Option
- func WithCookieName(val string) Option
- func WithCookiePath(val string) Option
- func WithCookieSameSite(val string) Option
- func WithEntryNameAndType(entryName, entryType string) Option
- func WithIgnorePrefix(paths ...string) Option
- func WithSkipper(skip Skipper) Option
- func WithTokenLength(val int) Option
- func WithTokenLookup(val string) Option
- type Skipper
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Option ¶
type Option func(*optionSet)
Option if for middleware options while creating middleware
func WithCookieDomain ¶
WithCookieDomain provide domain of the CSRF cookie. Optional. Default value "".
func WithCookieHTTPOnly ¶
WithCookieHTTPOnly indicates if CSRF cookie is HTTP only. Optional. Default value false.
func WithCookieMaxAge ¶
WithCookieMaxAge provide max age (in seconds) of the CSRF cookie. Optional. Default value 86400 (24hr).
func WithCookieName ¶
WithCookieName provide name of the CSRF cookie. This cookie will store CSRF token. Optional. Default value "csrf".
func WithCookiePath ¶
WithCookiePath provide path of the CSRF cookie. Optional. Default value "".
func WithCookieSameSite ¶
WithCookieSameSite indicates SameSite mode of the CSRF cookie. Optional. Default value SameSiteDefaultMode.
func WithEntryNameAndType ¶
WithEntryNameAndType provide entry name and entry type.
func WithIgnorePrefix ¶
WithIgnorePrefix provide paths prefix that will ignore. Mainly used for swagger main page and RK TV entry.
func WithTokenLength ¶
WithTokenLength the length of the generated token. Optional. Default value 32.
func WithTokenLookup ¶
WithTokenLookup a string in the form of "<source>:<key>" that is used to extract token from the request. Optional. Default value "header:X-CSRF-Token". Possible values: - "header:<name>" - "form:<name>" - "query:<name>" Optional. Default value "header:X-CSRF-Token".