keycodes work, need some documentation

This commit is contained in:
Kevin Darby committed 2019-06-06 16:40:32 -04:00
1 parent 0da6b2cc3e
commit 8a1d49733e
5 files changed
+31 -10

No files matched your search

+7 -4
View File
@@ -23,13 +23,15 @@ namespace api {
namespace auth {
const std::string AuthSessionManager::PUBLIC_KEY =
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAseguRgLD88QdhK0agy8f"
"-----BEGIN PUBLIC KEY-----\n"
"MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAseguRgLD88QdhK0agy8f"
"gz3SXp/hmp377+Q+z3OQqGG5kWyKnQfkAQDFeSv8o1iwSQupN0D1QOXyDnV1jmue"
"rqTitasGeq4AwKLhY89O/VuXc+URAO+HZ7EqVWfb3Nv4EOZRiiVsxmVBkld73Rcy"
"UAS4OXh4jDtE8IzOoXB7HhlMPBIAkueqdyy/v9zamzKrxPzWd+IW/IYEdCrUS8ES"
"mxOkeadSHVeH2nlHVREdktE3wKRd3fZ3OkyGaHnUPxBoUW1Ex57BpwdMGUqLZ3W2"
"92yQa/32dsLocoTri4iiImvQ/0JvfhnY9MDTZnmIgb8bPWSvPblQN0RR9OkRDFT9"
"3QIDAQAB";
"3QIDAQAB"
"\n-----END PUBLIC KEY-----\n";
AuthSessionManager::AuthSessionManager() : _map(), _nusers(), _expiration()
{
@@ -63,7 +65,8 @@ bool AuthSessionManager::add_or_replace_session(const api::user::TokenPayload& t
bool AuthSessionManager::check_session(const api::user::TokenPayload& tok)
{
if(datetime::ll_now() < _expiration)
auto now = datetime::ll_now();
if(datetime::ll_diff_in_us(now, _expiration) > 0)
{
if(tok.wheel())
return true;
@@ -71,7 +74,7 @@ bool AuthSessionManager::check_session(const api::user::TokenPayload& tok)
if(it != _map.end())
{
return google::protobuf::util::MessageDifferencer::Equivalent(tok, it->second.token)
&& (tok.date() < _expiration);
&& datetime::ll_diff_in_us(tok.date(), _expiration) > 0;
}
}
return false;