1 // This may look like C code, but it's really -*- C++ -*-
2 /*
3  * Copyright (C) 2012 Emweb bv, Herent, Belgium.
4  *
5  * See the LICENSE file for terms of use.
6  */
7 #ifndef SESSION_H_
8 #define SESSION_H_
9 
10 #include <Wt/Auth/Login.h>
11 #include <Wt/Auth/Dbo/UserDatabase.h>
12 
13 #include <Wt/Dbo/Session.h>
14 #include <Wt/Dbo/ptr.h>
15 
16 #include "User.h"
17 
18 using namespace Wt;
19 
20 namespace dbo = Dbo;
21 
22 typedef Auth::Dbo::UserDatabase<AuthInfo> UserDatabase;
23 
24 class Session : public dbo::Session
25 {
26 public:
27   static void configureAuth();
28 
29   Session(const std::string& sqliteDb);
30 
31   dbo::ptr<User> user() const;
32 
33   Auth::AbstractUserDatabase& users();
login()34   Auth::Login& login() { return login_; }
35 
36   static const Auth::AuthService& auth();
37 
38 private:
39   std::unique_ptr<UserDatabase> users_;
40   Auth::Login login_;
41 };
42 
43 #endif // SESSION_H_
44