Documentation
¶
Overview ¶
Package client implements the yarilo-auth TAB-delimited client protocol. All public methods are safe for use from a single goroutine; do not share a Client across goroutines without external synchronization.
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ( ErrAuthFailed = errors.New("auth/client: authentication failed") ErrTempFail = errors.New("auth/client: temporary backend failure") ErrUserNotFound = errors.New("auth/client: user not found") )
Sentinel errors returned by Authenticate, Verify, and LookupUser.
Functions ¶
This section is empty.
Types ¶
type AuthResult ¶
AuthResult carries the fields from a successful AUTH OK response.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a single persistent connection to yarilo-auth.
func Dial ¶
Dial connects to addr (TCP or Unix socket) and performs the VERSION handshake. tlsCfg may be nil for plain (non-TLS) connections.
func (*Client) Authenticate ¶
func (c *Client) Authenticate(username, password, service, remoteIP, sessionID string) (*AuthResult, error)
Authenticate sends an AUTH command for the given credentials and returns the result. remoteIP and sessionID may be empty strings (omitted from request).
func (*Client) LookupUser ¶ added in v1.57.0
LookupUser sends a USER command to yarilo-auth and returns whether the user exists in the userdb. Returns ErrUserNotFound when the user is unknown, ErrTempFail on a transient backend error.
func (*Client) Verify ¶
Verify sends a VERIFY command and returns the username, session ID, and service bound to the token. username and sessionID are sent as binding claims — the server rejects the token if they don't match what was stored at issue time. Returns ErrAuthFailed when the token is unknown, expired, or the claims don't match.