authz

package
v1.9.0 Latest Latest
Warning

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

Go to latest
Published: Sep 14, 2026 License: Apache-2.0 Imports: 9 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	FenceURL     = flag.String("fence-url", "", "URL to user fencing config (eg. https://github.com/myorg/beyond-config/main/raw/fence.json)")
	SitesURL     = flag.String("sites-url", "", "URL to allowed sites config (eg. https://github.com/myorg/beyond-config/main/raw/sites.json)")
	AllowlistURL = flag.String("allowlist-url", "", "URL to site allowlist (eg. https://github.com/myorg/beyond-config/main/raw/allowlist.json)")
)
View Source
var (
	HostsCSV  = flag.String("hosts-csv", "", "rewrite nexthop hosts (format: from1=to1,from2=to2)")
	HostsURL  = flag.String("hosts-url", "", "URL to host mapping config (eg. https://github.com/myorg/beyond-config/main/raw/hosts.json)")
	HostsOnly = flag.Bool("hosts-only", false, "only allow requests to hosts in the host mapping")
)

Functions

func Allowlisted

func Allowlisted(r *http.Request) bool

Allowlisted checks if a request is on the allowlist

func Deny

func Deny(r *http.Request, user string) bool

Deny checks if a user is denied access based on fence and sites configuration

func GetHostsMap

func GetHostsMap() map[string]string

GetHostsMap returns the current host mappings (for testing)

func GetSitesMap

func GetSitesMap(key string) map[string]bool

GetSitesMap returns the sites map for a given key (for testing)

func GetSitesURLs

func GetSitesURLs(fn func(siteURL string))

GetSitesURLs returns all site URLs for proxy configuration

func HostAllowed

func HostAllowed(host string) bool

HostAllowed checks if a host is allowed based on hosts-only configuration.

func HostsSetup

func HostsSetup(cfg string) error

HostsSetup initializes host mappings from CSV configuration

func RefreshAllowlist

func RefreshAllowlist() error

RefreshAllowlist loads the site allowlist configuration

func RefreshFence

func RefreshFence() error

RefreshFence loads the user fencing configuration

func RefreshHosts

func RefreshHosts() error

RefreshHosts loads host mappings from URL configuration

func RefreshSites

func RefreshSites() error

RefreshSites loads the allowed sites configuration

func RewriteHost

func RewriteHost(host string) string

RewriteHost returns the rewritten host (backward compatibility)

func SetHTTPClient

func SetHTTPClient(client *http.Client)

SetHTTPClient sets the HTTP client for ACL operations (useful for testing)

func SetHostsMap

func SetHostsMap(m map[string]string)

SetHostsMap sets the host mappings (for testing)

func SetSitesMap

func SetSitesMap(key string, value map[string]bool)

SetSitesMap sets the sites map for a given key (for testing)

Types

type HostRewrite

type HostRewrite struct {
	Host    string
	Scheme  string // http, https, or empty (preserve original)
	Port    string // port number or empty
	FullURL string // complete rewritten URL if available
}

HostRewrite contains the rewritten host information

func HostRewriteDetailed

func HostRewriteDetailed(authority string) *HostRewrite

HostRewriteDetailed returns a consistent hostname and URL for the backend.

Jump to

Keyboard shortcuts

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