summaryrefslogtreecommitdiffstats
path: root/src/token_authorization_middleware_test.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/token_authorization_middleware_test.cpp')
-rw-r--r--src/token_authorization_middleware_test.cpp17
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);
OpenPOWER on IntegriCloud