7684972a | /* Copyright (C) CJ Affiliate * * You may use, distribute and modify this code under the * terms of the GNU General Public License version 2 or * later. * * You should have received a copy of the license with this * file. If not, you will find a copy in the "LICENSE" file * at https://github.com/cjdev/dual-control. */ |
7699d7ec | #ifndef _TOKEN_H #define _TOKEN_H |
b5e563ba | |
f757e35b | #include <string> #include <memory> |
b5e563ba | |
f757e35b | #include "user.h" |
215ea751 | #include "sys_fstream.h" |
f757e35b | |
3a7bcdbe | class user_token_supplier_ifc |
cdf7fd74 | { public: |
bef74c28 | virtual ~user_token_supplier_ifc() {} virtual std::string token (user &user) |
b65518d3 | { |
b5e563ba | return ""; |
3a7bcdbe | } |
9af49688 | }; |
3a7bcdbe | |
3ae0e083 | class user_token_supplier |
b65518d3 | { |
0e218820 | public: typedef std::shared_ptr<user_token_supplier_ifc> delegate; private: delegate delegate_; public: user_token_supplier (delegate delegate) : |
b65518d3 | delegate_ (delegate) {} |
0e218820 | user_token_supplier() : user_token_supplier ( delegate (new user_token_supplier_ifc)) {} std::string token (user &user) { return delegate_->token (user); } |
215ea751 | static user_token_supplier create (fstreams &fstreams); |
3a7bcdbe | }; |
7699d7ec | #endif |
92957308 |