go-authcrunch icon indicating copy to clipboard operation
go-authcrunch copied to clipboard

feature: fast-path for password match in basicauth [non token mode]

Open vlahan opened this issue 1 year ago • 0 comments

When non-token authentication, e.g direct basicauth is used via the caddy security plugin, each request currently has to go through the costly bcrypt.CompareHashAndPassword method resulting in ~ 4s latency to each call:

https://github.com/greenpau/go-authcrunch/blob/50f3edc60f01348d580c769761097734f4f0527e/pkg/identity/password.go#L117

Adding a cached fast-path as in the core caddyauth module would significantly improve the call latency for the follow-up requests:

https://github.com/caddyserver/caddy/blob/3b3d67871446ee6bf1921938ef0f16b6112c7ceb/modules/caddyhttp/caddyauth/basicauth.go#L186

vlahan avatar Nov 10 '23 13:11 vlahan