mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-06-08 06:32:55 -04:00
Improve debugabbility of JSON API
JSON API server uses standardized error handling based on std::error_condition for a few method, this improve debugabbility both from library size and from API client side JSON API auth token are now more flexible, now the only proibition is using colon character ':' in user name Implemented TO_JSON operation for std::error_condition Avoid unkown serial job handling code duplication via fatalUnknownSerialJob Usability improvement in t_RsLogger Disable compilation of now unused is_alphanumeric
This commit is contained in:
parent
9c65836503
commit
5dbbe1ffd7
9 changed files with 311 additions and 99 deletions
|
@ -90,9 +90,8 @@ public:
|
|||
void connectToConfigManager(p3ConfigMgr& cfgmgr) override;
|
||||
|
||||
/// @see RsJsonApi
|
||||
virtual bool authorizeUser(
|
||||
const std::string& alphanumeric_user,
|
||||
const std::string& alphanumeric_passwd ) override;
|
||||
virtual std::error_condition authorizeUser(
|
||||
const std::string& user, const std::string& passwd ) override;
|
||||
|
||||
/// @see RsJsonApi
|
||||
std::map<std::string,std::string> getAuthorizedTokens() override;
|
||||
|
@ -101,10 +100,13 @@ public:
|
|||
bool revokeAuthToken(const std::string& user) override;
|
||||
|
||||
/// @see RsJsonApi
|
||||
bool isAuthTokenValid(const std::string& token) override;
|
||||
bool isAuthTokenValid(
|
||||
const std::string& token,
|
||||
std::error_condition& error = RS_DEFAULT_STORAGE_PARAM(std::error_condition)
|
||||
) override;
|
||||
|
||||
/// @see RsJsonAPI
|
||||
bool requestNewTokenAutorization(
|
||||
std::error_condition requestNewTokenAutorization(
|
||||
const std::string& user, const std::string& password ) override;
|
||||
|
||||
/// @see RsJsonApi
|
||||
|
@ -143,10 +145,19 @@ public:
|
|||
const std::function<bool(const std::string&, const std::string&)>&
|
||||
callback );
|
||||
|
||||
/// @see RsJsonApi
|
||||
const std::error_category& errorCategory() override
|
||||
{ return sErrorCategory; }
|
||||
|
||||
protected:
|
||||
/// @see RsThread
|
||||
void onStopRequested() override;
|
||||
|
||||
static const RsJsonApiErrorCategory sErrorCategory;
|
||||
|
||||
static std::error_condition badApiCredientalsFormat(
|
||||
const std::string& user, const std::string& passwd );
|
||||
|
||||
private:
|
||||
/// @see RsThread
|
||||
void run() override;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue