httpsecure

package
v0.0.0-...-9823ec8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 13, 2021 License: Apache-2.0 Imports: 2 Imported by: 0

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.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL