Documentation ¶
Overview ¶
Package httpsecure provides a complete http security layer for the Sonic API Gateway
Index ¶
Examples ¶
Constants ¶
View Source
const Namespace = "github.com/starvn/sonic/security/httpsecure"
Variables ¶
This section is empty.
Functions ¶
func ConfigGetter ¶
func ConfigGetter(e config.ExtraConfig) interface{}
Example ¶
cfg := ConfigGetter(config.ExtraConfig{ Namespace: map[string]interface{}{ "allowed_hosts": []interface{}{"host1"}, "host_proxy_headers": []interface{}{"x-custom-header"}, "sts_seconds": 10.0, "ssl_redirect": true, "ssl_host": "secure.example.com", }, }) fmt.Println(cfg)
Output: {false false false false false false true false false false false secure.example.com [host1] false [x-custom-header] <nil> map[] 10 }
Example (FromParsedData) ¶
sample := `{ "allowed_hosts": ["host1"], "ssl_proxy_headers": {}, "sts_seconds": 300, "frame_deny": true, "sts_include_subdomains": true }` parsedCfg := map[string]interface{}{} if err := json.Unmarshal([]byte(sample), &parsedCfg); err != nil { fmt.Println(err) return } cfg := ConfigGetter(config.ExtraConfig{Namespace: parsedCfg}) fmt.Println(cfg)
Output: {false false false true false false false false false true false [host1] false [] <nil> map[] 300 }
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.