diff options
| author | Ed Tanous <ed.tanous@intel.com> | 2017-06-22 15:41:02 -0700 |
|---|---|---|
| committer | Ed Tanous <ed.tanous@intel.com> | 2017-06-22 15:41:02 -0700 |
| commit | 4d92cbfe32ef6ee24547401cc06994baa84a24aa (patch) | |
| tree | 5d3a04485b2eab08cf128d3cc8e66d7424e9e332 /src/token_authorization_middleware_test.cpp | |
| parent | d464987e65d11bec8eca23dc996015f6914894eb (diff) | |
| download | bmcweb-4d92cbfe32ef6ee24547401cc06994baa84a24aa.tar.gz bmcweb-4d92cbfe32ef6ee24547401cc06994baa84a24aa.zip | |
incremental
Diffstat (limited to 'src/token_authorization_middleware_test.cpp')
| -rw-r--r-- | src/token_authorization_middleware_test.cpp | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/src/token_authorization_middleware_test.cpp b/src/token_authorization_middleware_test.cpp index 49933c9..e3a18f1 100644 --- a/src/token_authorization_middleware_test.cpp +++ b/src/token_authorization_middleware_test.cpp @@ -6,13 +6,7 @@ using namespace crow; using namespace std; -class KnownLoginAuthenticator { - public: - inline bool authenticate(const std::string& username, - const std::string& password) { - return (username == "dude") && (password == "foo"); - } -}; + // Tests that static urls are correctly passed TEST(TokenAuthentication, TestBasicReject) { @@ -185,6 +179,15 @@ TEST(TokenAuthentication, TestPostBadLoginUrl) { app.stop(); } +// Test class that allows login for a fixed password. +class KnownLoginAuthenticator { + public: + inline bool authenticate(const std::string& username, + const std::string& password) { + return (username == "dude") && (password == "foo"); + } +}; + TEST(TokenAuthentication, TestSuccessfulLogin) { App<crow::TokenAuthorization<KnownLoginAuthenticator>> app; app.bindaddr("127.0.0.1").port(45451); |

