80 bool allowed(
const std::string &cmd);
json system_overview(const json &req)
Presents an overview of the system to the end user.
std::shared_ptr< Token > TokenPtr
WSServer & server_
The API server.
void abort_session()
Abort the current websocket session.
This is the header file for a generated source file, GitSHA1.cpp.
void mark_authenticated(Auth::TokenPtr token)
SecurityContext & security_context() const
void clear_authentication()
This is the application-level object that provide the API.
json logout(const json &req)
Log an user out.
json get_leosac_version(const json &)
Retrieve the current version number of Leosac.
The implementation class that runs the websocket server.
std::shared_ptr< User > UserPtr
A SecurityContext is used to query permission while doing an operation.
AuthStatus
Enumeration describing the authentication status of a client.
std::unique_ptr< SecurityContext > security_
APISession(WSServer &server)
json authenticate_with_token(const json &req)
Attempt to authenticate with a (previously generated) authentication token.
Auth::UserId current_user_id() const
Retrieve the UserId of the user associated with this API session.
Auth::TokenPtr current_auth_token_
The token we are authenticated with.
json create_auth_token(const json &req)
Generate an authentication token using the user credential, and logs the user in on success...
void hook_before_request()
A hook that is called before a request processing method will be invoked.
Auth::UserPtr current_user() const
Retrieve the user associated with the session, or nullptr.
bool allowed(const std::string &cmd)
Is this API client allowed to perform the request cmd ?
Auth::TokenPtr current_token() const
Retrieve the currently in-use token, or nullptr.