From 8140f6f9550733b7543782728e7d0e6c0bc345f5 Mon Sep 17 00:00:00 2001 From: kambizzandi Date: Mon, 4 Apr 2022 10:21:04 +0430 Subject: [PATCH] created new api at /Account/Auth/validateJWT --- Modules/Account/moduleSrc/Account.cpp | 2 + Modules/Account/moduleSrc/ORM/Auth.cpp | 43 +++++++++++++++++++ Modules/Account/moduleSrc/ORM/Auth.h | 55 +++++++++++++++++++++++++ Modules/Account/moduleSrc/moduleSrc.pro | 2 + 4 files changed, 102 insertions(+) create mode 100644 Modules/Account/moduleSrc/ORM/Auth.cpp create mode 100644 Modules/Account/moduleSrc/ORM/Auth.h diff --git a/Modules/Account/moduleSrc/Account.cpp b/Modules/Account/moduleSrc/Account.cpp index 835f4c0b..4f55c0e5 100644 --- a/Modules/Account/moduleSrc/Account.cpp +++ b/Modules/Account/moduleSrc/Account.cpp @@ -40,6 +40,7 @@ #include "ORM/User.h" #include "ORM/UserWallets.h" #include "ORM/WalletTransactions.h" +#include "ORM/Auth.h" #include "Payment/PaymentLogic.h" #include "Payment/intfPaymentGateway.h" //#include "Interfaces/ORM/APIQueryBuilders.h" @@ -175,6 +176,7 @@ Account::Account() : this->addSubModule(&UserWallets::instance()); this->addSubModule(&WalletTransactions::instance()); this->addSubModule(&WalletBalances::instance()); + this->addSubModule(&Auth::instance()); if (Account::InvalidPasswordsFile.value().size()) { QFile InputFile(Account::InvalidPasswordsFile.value()); diff --git a/Modules/Account/moduleSrc/ORM/Auth.cpp b/Modules/Account/moduleSrc/ORM/Auth.cpp new file mode 100644 index 00000000..340d7eb8 --- /dev/null +++ b/Modules/Account/moduleSrc/ORM/Auth.cpp @@ -0,0 +1,43 @@ +/****************************************************************************** +# TargomanAPI: REST API for Targoman +# +# Copyright 2014-2020 by Targoman Intelligent Processing +# +# TargomanAPI is free software: you can redistribute it and/or modify +# it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# TargomanAPI is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# along with Targoman. If not, see . + ******************************************************************************/ +/** + * @author S. Mehran M. Ziabary + * @author Kambiz Zandi + */ + +#include "Auth.h" + +namespace Targoman::API::AccountModule::ORM { + +Auth::Auth() : + intfPureModule( + "Account" + ) +{} + +bool Auth::apivalidateJWT( + TAPI::JWT_t _JWT + ) +{ + Q_UNUSED(_JWT); + + return true; +} + +} //namespace Targoman::API::AccountModule::ORM diff --git a/Modules/Account/moduleSrc/ORM/Auth.h b/Modules/Account/moduleSrc/ORM/Auth.h new file mode 100644 index 00000000..93e003f7 --- /dev/null +++ b/Modules/Account/moduleSrc/ORM/Auth.h @@ -0,0 +1,55 @@ +/****************************************************************************** +# TargomanAPI: REST API for Targoman +# +# Copyright 2014-2020 by Targoman Intelligent Processing +# +# TargomanAPI is free software: you can redistribute it and/or modify +# it under the terms of the GNU AFFERO GENERAL PUBLIC LICENSE as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# TargomanAPI is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU AFFERO GENERAL PUBLIC LICENSE for more details. +# +# You should have received a copy of the GNU AFFERO GENERAL PUBLIC LICENSE +# along with Targoman. If not, see . + ******************************************************************************/ +/** + * @author S. Mehran M. Ziabary + * @author Kambiz Zandi + */ + +#ifndef TARGOMAN_API_MODULES_ACCOUNT_ORM_AUTH_H +#define TARGOMAN_API_MODULES_ACCOUNT_ORM_AUTH_H + +#include "Interfaces/AAA/AAA.hpp" +#include "Interfaces/API/intfPureModule.h" + +namespace Targoman::API::AccountModule { + +//structures and enumes goes here + +namespace ORM { + +class Auth : public intfPureModule +{ + Q_OBJECT + TARGOMAN_DEFINE_API_SUBMODULE(Account, Auth) + +private slots: + bool REST_GET_OR_POST( + validateJWT, + ( + TAPI::JWT_t _JWT + ), + "Check JWT" + ) + +}; + +} //namespace ORM +} //namespace Targoman::API::AccountModule + +#endif // TARGOMAN_API_MODULES_ACCOUNT_ORM_AUTH_H diff --git a/Modules/Account/moduleSrc/moduleSrc.pro b/Modules/Account/moduleSrc/moduleSrc.pro index 287e9c54..e8b5164a 100644 --- a/Modules/Account/moduleSrc/moduleSrc.pro +++ b/Modules/Account/moduleSrc/moduleSrc.pro @@ -14,6 +14,7 @@ HEADERS += \ ORM/APITokens.h \ ORM/APITokenValidIPs.h \ ORM/ApprovalRequest.h \ + ORM/Auth.h \ ORM/BlockingRules.h \ ORM/ForgotPassRequest.h \ ORM/IPBin.h \ @@ -40,6 +41,7 @@ SOURCES += \ ORM/APITokens.cpp \ ORM/APITokenValidIPs.cpp \ ORM/ApprovalRequest.cpp \ + ORM/Auth.cpp \ ORM/BlockingRules.cpp \ ORM/ForgotPassRequest.cpp \ ORM/IPBin.cpp \