validation

package
v0.0.0-...-f274180 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 10 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateHostname

func ValidateHostname(hostname string) (string, error)

func ValidateUrl

func ValidateUrl(originUrl string) (*url.URL, error)

ValidateUrl returns a validated version of `originUrl` with a scheme prepended (by default http://). Note: when originUrl contains a scheme, the path is removed:

ValidateUrl("https://localhost:8080/api/") => "https://localhost:8080"

but when it does not, the path is preserved:

ValidateUrl("localhost:8080/api/") => "http://localhost:8080/api/"

This is arguably a bug, but changing it might break some cloudflared users.

Types

type Access

type Access struct {
	// contains filtered or unexported fields
}

Access checks if a JWT from Cloudflare Access is valid.

func NewAccessValidator

func NewAccessValidator(ctx context.Context, domain, issuer, applicationAUD string) (*Access, error)

func (*Access) Validate

func (a *Access) Validate(ctx context.Context, jwt string) error

func (*Access) ValidateRequest

func (a *Access) ValidateRequest(ctx context.Context, r *http.Request) error

Jump to

Keyboard shortcuts

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