Documentation
¶
Index ¶
- func DomainAllowed(ctx context.Context, domain string) bool
- func GetClaims(ctx context.Context) (jwt.Token, bool)
- func GetDomains(ctx context.Context) ([]string, bool)
- func GetUser(ctx context.Context) (string, bool)
- type Authenticator
- type JWTAuthenticator
- type OIDCDiscovery
- type PSKAuthenticator
- type TSNetAuthenticator
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DomainAllowed ¶
DomainAllowed returns true if the domain is allowed to the user If the authorization context contains a domain allowlist, the value must be present in the claim If the allowlist is not set or nil, then all domains are allowed
func GetDomains ¶
GetDomains retrieves the list of allowed domains (if any) from the request context
Types ¶
type Authenticator ¶
type Authenticator interface {
// Middleware returns an HTTP middleware that validates authentication
Middleware(next http.Handler) http.Handler
}
Authenticator is the interface that all authenticators must implement
type JWTAuthenticator ¶
type JWTAuthenticator struct {
// contains filtered or unexported fields
}
JWTAuthenticator handles OAuth2/OIDC authentication for the API
func NewJWTAuthenticator ¶
func NewJWTAuthenticator(ctx context.Context, issuerURL string, audience string, requiredScopes []string, domainsClaim string) (*JWTAuthenticator, error)
NewJWTAuthenticator creates a new OAuth2/OIDC authenticator
func (*JWTAuthenticator) Middleware ¶
func (a *JWTAuthenticator) Middleware(next http.Handler) http.Handler
Middleware returns an HTTP middleware that validates OAuth2 bearer tokens
type OIDCDiscovery ¶
OIDCDiscovery represents the OIDC discovery document
type PSKAuthenticator ¶
type PSKAuthenticator struct {
// contains filtered or unexported fields
}
PSKAuthenticator handles pre-shared key authentication
func NewPSKAuthenticator ¶
func NewPSKAuthenticator(preSharedKey string) (*PSKAuthenticator, error)
NewPSKAuthenticator creates a new pre-shared key authenticator
func (*PSKAuthenticator) Middleware ¶
func (a *PSKAuthenticator) Middleware(next http.Handler) http.Handler
Middleware returns an HTTP middleware that validates pre-shared key authentication
type TSNetAuthenticator ¶
type TSNetAuthenticator struct {
// contains filtered or unexported fields
}
TSNetAuthenticator handles authentication using Tailscale identity This authenticator can only be used when the server is running with tsnet listener
func NewTSNetAuthenticator ¶
func NewTSNetAuthenticator(tsnetServer *tsnetserver.TSNetServer) (*TSNetAuthenticator, error)
NewTSNetAuthenticator creates a new Tailscale identity authenticator The localClient is used to query the Tailscale LocalAPI for identity information
func (*TSNetAuthenticator) Middleware ¶
func (a *TSNetAuthenticator) Middleware(next http.Handler) http.Handler
Middleware returns an HTTP middleware that validates Tailscale identity