25 #include <boost/date_time/posix_time/posix_time.hpp> 41 #pragma db object optimistic 55 const std::string &
id()
const;
61 const std::string &
token()
const;
87 auto duration_second = duration_cast<seconds>(duration);
89 auto now = boost::posix_time::second_clock::local_time();
90 expiration_ = now + boost::posix_time::seconds(duration_second.count());
94 friend class odb::access;
100 #pragma db type("VARCHAR(128)") 107 #pragma db on_delete(cascade)
An authentication token used for authenticating a user against Leosac.
UserPtr owner_
The user owning the token.
This is the header file for a generated source file, GitSHA1.cpp.
UserPtr owner() const
Retrieve a shared_ptr to the user owning the token.
const std::string & id() const
Return the token identifier.
boost::posix_time::ptime expiration() const
Retrieve the unix timestamp at which the token will/has expire(d).
bool is_valid() const
Check if the token is still active.
void expire_in(const T &duration)
Set the expiration point of the token to be now + duration.
boost::posix_time::ptime expiration_
Exception class for LEOSAC Project related errors.
std::shared_ptr< User > UserPtr
std::string token_
The string representation of the token.
const std::string & token() const
Retrieve the string representation of the token.