Documentation
¶
Overview ¶
Package safehttp is the HTTP client sign-in uses to reach identity providers.
Everything it sends goes through a client that dials only the provider's own hosts, resolves them itself and refuses private, loopback and link-local addresses, so a mistake in configuration can't make backd reach inside the network.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var BuiltinHosts = map[string][]string{
"google": {"accounts.google.com", "oauth2.googleapis.com", "www.googleapis.com"},
"microsoft": {"login.microsoftonline.com"},
"apple": {"appleid.apple.com"},
"github": {"github.com", "api.github.com"},
}
BuiltinHosts are the hosts of each built-in provider.
var ErrHostNotAllowed = errors.New("sso: the host is not one of the provider's")
ErrHostNotAllowed means a request named a host that is not one of the provider's.
Functions ¶
func BuiltinHostAllowed ¶
BuiltinHostAllowed accepts the hosts of the built-in providers.
func ForProvider ¶
ForProvider returns a context whose requests may also reach the given hosts (a provider's own, which only its configuration names), and, when private, resolve them to private addresses: the ranges of a network (10/8, 172.16/12, 192.168/16, fc00::/7, 100.64/10), never loopback, link-local, the metadata address or anything that isn't a unicast address.
func NewClient ¶
NewClient returns an HTTP client that connects only to hosts allowed accepts, by name (or that the request's context names with ForProvider), and, unless allowPrivate, only to public addresses (checked after the name is resolved, on the address actually dialed). It follows no redirect and uses no proxy from the environment.
Types ¶
This section is empty.