92b68213 | #ifndef _VALIDATOR_H #define _VALIDATOR_H |
f757e35b | #include <string> |
16ade8ba | #include <memory> |
f757e35b | |
3c673060 | #include "user.h" |
9af49688 | #include "token.h" |
3c673060 | |
cdf7fd74 | class validator_ifc { public: virtual ~validator_ifc() {} |
b017a4d2 | virtual bool validate (const std::string &user_name, const std::string &token) |
cdf7fd74 | { return false; } |
caf7db60 | }; |
cdf7fd74 | class validator : public validator_ifc { private: std::shared_ptr<validator_ifc> delegate_; public: |
b017a4d2 | validator (const std::shared_ptr<validator_ifc> &delegate) : delegate_ (delegate) {} validator() : validator (std::shared_ptr<validator_ifc> (new validator_ifc)) {} bool validate (const std::string &user_name, const std::string &token) |
cdf7fd74 | { |
b017a4d2 | return delegate_->validate (user_name, token); |
cdf7fd74 | } |
6c14d27a | }; |
caf7db60 | |
28855478 | validator create_validator (const directory &directory, const user_token_supplier_p &token_supplier); |
f757e35b | #endif |
92957308 |