Documentation ¶
Index ¶
- type OriginChecker
- func (os *OriginChecker) Add(origin string)
- func (os *OriginChecker) AddRawURLs(urls []string)
- func (os *OriginChecker) CheckOrigin(r *http.Request, origin string) bool
- func (os *OriginChecker) Delete(origin string)
- func (os *OriginChecker) DeleteAll()
- func (os *OriginChecker) IsPresent(origin string) bool
- func (os *OriginChecker) With(f func(r *http.Request, origin string) bool) *OriginChecker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type OriginChecker ¶
OriginChecker holds user's AllowOriginRequestFunc and checks dynamically added CORS origins from an all app's redirect urls.
func NewOriginChecker ¶
func NewOriginChecker() *OriginChecker
NewOriginChecker creates new instance of an OriginChecker.
func (*OriginChecker) Add ¶
func (os *OriginChecker) Add(origin string)
Add adds origin to the list of allowed origins.
func (*OriginChecker) AddRawURLs ¶
func (os *OriginChecker) AddRawURLs(urls []string)
AddRawURLs parses and adds urls to the list of allowed origins.
func (*OriginChecker) CheckOrigin ¶
func (os *OriginChecker) CheckOrigin(r *http.Request, origin string) bool
CheckOrigin is a custom func for validate origin, checking it with all AllowOriginRequestFuncs, including user's provided func.
func (*OriginChecker) Delete ¶
func (os *OriginChecker) Delete(origin string)
Delete removes origin from the list of allowed origins.
func (*OriginChecker) DeleteAll ¶
func (os *OriginChecker) DeleteAll()
DeleteAll removes all origins from the global origin map.
func (*OriginChecker) IsPresent ¶
func (os *OriginChecker) IsPresent(origin string) bool
IsPresent returns true if the provided origin presented in the origins map, false otherwise.
func (*OriginChecker) With ¶
func (os *OriginChecker) With(f func(r *http.Request, origin string) bool) *OriginChecker
With adds AllowOriginRequestFunc to list of checks.