Tidied up code, going to put up the coding convention later on

This commit is contained in:
amazing-username
2019-09-04 15:41:43 +00:00
parent dd995269df
commit d4e9b8c71f
73 changed files with 1334 additions and 1368 deletions
+37
View File
@@ -0,0 +1,37 @@
#ifndef TOKEN_MANAGER_H_
#define TOKEN_MANAGER_H_
#include <string>
#include <string_view>
#include <utility>
#include <vector>
#include <jwt-cpp/jwt.h>
#include "model/Models.h"
#include "type/Scopes.h"
namespace manager
{
class TokenManager
{
public:
TokenManager();
model::LoginResult retrieveToken();
model::LoginResult retrieveToken(std::string_view);
model::LoginResult retrieveToken(const model::BinaryPath&);
bool isTokenValid(std::string&, type::Scope);
private:
model::AuthCredentials parseAuthCredentials(std::string_view);
model::AuthCredentials parseAuthCredentials(const model::BinaryPath&);
std::vector<std::string> extractScopes(const jwt::decoded_jwt&&);
std::pair<bool, std::vector<std::string>> fetchAuthHeader(const std::string&);
bool tokenSupportsScope(const std::vector<std::string>, const std::string&&);
};
}
#endif