|
Csilk 0.2.1
A lightweight, high-performance C HTTP web framework
|
Token-based authentication middleware implementation. More...

Functions | |
| void | csilk_auth_middleware (csilk_ctx_t *c, csilk_auth_validator_t validator) |
| Token-based authentication middleware. | |
Token-based authentication middleware implementation.
| void csilk_auth_middleware | ( | csilk_ctx_t * | c, |
| csilk_auth_validator_t | validator | ||
| ) |
Token-based authentication middleware.
Simple token-based authentication middleware.
Extracts the Bearer token from the Authorization header and validates it using the caller-provided validator callback. If validation fails, a 401 Unauthorized response is sent with a WWW-Authenticate header, and the request pipeline is aborted.
| c | The request context. |
| validator | Callback that receives the token string and returns non-zero if the token is valid, zero otherwise. |