|
lintel 0.2.0
|
#include <Controller.h>
Classes | |
| struct | Method |
Public Member Functions | |
| Controller (std::shared_ptr< IAuthService > authService) | |
| ~Controller () override=default | |
| void | setTrustedProxies (std::vector< std::string > trustedProxies) |
| void | registerMethods (std::shared_ptr< httplib::Server > &server) |
Public Member Functions inherited from lintel::GroupProvider | |
| GroupProvider ()=default | |
| void | add (const Group &group) |
| virtual | ~GroupProvider ()=default |
| const std::vector< Group > & | provide () |
Protected Types | |
| enum | HttpType { Get , Put , Post , Delete } |
| using | HandlerArgs = void(const httplib::Request &, httplib::Response &) |
| using | HandlerWithContentReaderArgs = void(const httplib::Request &, httplib::Response &, const httplib::ContentReader &) |
| using | Handler = std::function< HandlerArgs > |
| using | HandlerWithContentReader = std::function< HandlerWithContentReaderArgs > |
Protected Member Functions | |
| std::string | clientIpOf (const httplib::Request &request) |
| template<class Type , HttpType httpType> | |
| Type | addMethod (const std::string &pattern, Type handler) |
Static Protected Member Functions | |
| static PagingParams | pagingParamsOf (const httplib::Request &request) |
Protected Attributes | |
| std::shared_ptr< IAuthService > | m_authService |
| ClientIpResolver | m_ipResolver |
| std::map< HttpType, std::vector< Method > > | m_methods |
Base class for HTTP controllers with automatic method registration and auth
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
inlineexplicit |
| authService | authentication service for access control |
|
overridedefault |
Register a handler for a given HTTP method and URL pattern
|
protected |
Determine the client IP address of a request, honoring the X-Forwarded-For header (leftmost entry) only when the direct peer is a configured trusted proxy.
| request | the HTTP request |
|
staticprotected |
Parses keyset-paging query parameters ('after', 'limit').
| request | the HTTP request |
| HttpBadRequestException | on an invalid 'limit' value |
| void lintel::Controller::registerMethods | ( | std::shared_ptr< httplib::Server > & | server | ) |
Register all collected handler methods with the HTTP server
| void lintel::Controller::setTrustedProxies | ( | std::vector< std::string > | trustedProxies | ) |
Configure the trusted proxies allowed to forward X-Forwarded-For.
| trustedProxies | IPs or CIDR ranges (e.g. "10.0.0.0/8") |
|
protected |
|
protected |