Documentation
¶
Overview ¶
Package auth contains exported proxy auth values. These are used to ensure coherent usage across management and proxy implementations.
Index ¶
Constants ¶
const ( SessionCookieName = "nb_session" DefaultSessionExpiry = 24 * time.Hour SessionJWTIssuer = "netbird-management" )
const HeaderUserID = "header-user"
HeaderUserID is the synthetic user id recorded for header-authenticated requests. Header auth validates a per-service secret and resolves no user record, so proxy access logs and management-minted session tokens both attribute the request to this id.
Variables ¶
This section is empty.
Functions ¶
func ResolveProto ¶
func ResolveProto(forwardedProto string, conn *tls.ConnectionState) string
ResolveProto determines the protocol scheme based on the forwarded proto configuration. When set to "http" or "https" the value is used directly. Otherwise TLS state is used: if conn is non-nil "https" is returned, else "http".
func ValidateSessionJWT ¶
func ValidateSessionJWT(tokenString, domain string, publicKey ed25519.PublicKey) (userID, email, method string, groups, groupNames []string, err error)
ValidateSessionJWT validates a session JWT and returns the user ID, the user's email (when carried), the authentication method, any embedded group memberships, and the parallel group display names. email, groups, and groupNames may be empty for tokens minted before those claims were introduced. groupNames pairs positionally with groups.