44
55// Common includes
66#include " common/TraceException.hpp"
7+ #include " common/DynaLog.hpp"
78
89// Standard includes
910#include < iostream>
@@ -69,46 +70,47 @@ void AuthenticationManager::purge(const PublicKeyType pub_key_type) {
6970}
7071
7172void AuthenticationManager::incrementKeyAccessCounter (
72- const std::string &public_key) {
73+ const std::string &public_key,
74+ LogContext log_context) {
7375 std::lock_guard<std::mutex> lock (m_lock);
74- if (m_auth_mapper.hasKey (PublicKeyType::TRANSIENT, public_key)) {
76+ if (m_auth_mapper.hasKey (PublicKeyType::TRANSIENT, public_key, log_context )) {
7577 m_auth_mapper.incrementKeyAccessCounter (PublicKeyType::TRANSIENT,
76- public_key);
77- } else if (m_auth_mapper.hasKey (PublicKeyType::SESSION, public_key)) {
78- m_auth_mapper.incrementKeyAccessCounter (PublicKeyType::SESSION, public_key);
78+ public_key, log_context );
79+ } else if (m_auth_mapper.hasKey (PublicKeyType::SESSION, public_key, log_context )) {
80+ m_auth_mapper.incrementKeyAccessCounter (PublicKeyType::SESSION, public_key, log_context );
7981 }
8082 // Ignore persistent cases because counter does nothing for them
8183}
8284
83- bool AuthenticationManager::hasKey (const std::string &public_key) const {
85+ bool AuthenticationManager::hasKey (const std::string &public_key, LogContext log_context ) const {
8486 std::lock_guard<std::mutex> lock (m_lock);
8587
86- if (m_auth_mapper.hasKey (PublicKeyType::TRANSIENT, public_key)) {
88+ if (m_auth_mapper.hasKey (PublicKeyType::TRANSIENT, public_key, log_context )) {
8789 return true ;
8890 }
8991
90- if (m_auth_mapper.hasKey (PublicKeyType::SESSION, public_key)) {
92+ if (m_auth_mapper.hasKey (PublicKeyType::SESSION, public_key, log_context )) {
9193 return true ;
9294 }
9395
94- if (m_auth_mapper.hasKey (PublicKeyType::PERSISTENT, public_key)) {
96+ if (m_auth_mapper.hasKey (PublicKeyType::PERSISTENT, public_key, log_context )) {
9597 return true ;
9698 }
9799
98100 return false ;
99101}
100102
101- std::string AuthenticationManager::getUID (const std::string &public_key) const {
103+ std::string AuthenticationManager::getUID (const std::string &public_key, LogContext log_context ) const {
102104 std::lock_guard<std::mutex> lock (m_lock);
103105
104- if (m_auth_mapper.hasKey (PublicKeyType::TRANSIENT, public_key)) {
105- return m_auth_mapper.getUID (PublicKeyType::TRANSIENT, public_key);
106+ if (m_auth_mapper.hasKey (PublicKeyType::TRANSIENT, public_key, log_context )) {
107+ return m_auth_mapper.getUID (PublicKeyType::TRANSIENT, public_key, log_context );
106108 }
107- if (m_auth_mapper.hasKey (PublicKeyType::SESSION, public_key)) {
108- return m_auth_mapper.getUID (PublicKeyType::SESSION, public_key);
109+ if (m_auth_mapper.hasKey (PublicKeyType::SESSION, public_key, log_context )) {
110+ return m_auth_mapper.getUID (PublicKeyType::SESSION, public_key, log_context );
109111 }
110- if (m_auth_mapper.hasKey (PublicKeyType::PERSISTENT, public_key)) {
111- return m_auth_mapper.getUID (PublicKeyType::PERSISTENT, public_key);
112+ if (m_auth_mapper.hasKey (PublicKeyType::PERSISTENT, public_key, log_context )) {
113+ return m_auth_mapper.getUID (PublicKeyType::PERSISTENT, public_key, log_context );
112114 }
113115
114116 EXCEPT (1 , " Unrecognized public_key during execution of getUID." );
@@ -122,9 +124,11 @@ void AuthenticationManager::addKey(const PublicKeyType &pub_key_type,
122124}
123125
124126bool AuthenticationManager::hasKey (const PublicKeyType &pub_key_type,
125- const std::string &public_key) const {
127+ const std::string &public_key,
128+ LogContext log_context) const {
126129 std::lock_guard<std::mutex> lock (m_lock);
127- return m_auth_mapper.hasKey (pub_key_type, public_key);
130+
131+ return m_auth_mapper.hasKey (pub_key_type, public_key, log_context);
128132}
129133
130134void AuthenticationManager::migrateKey (const PublicKeyType &from_type,
@@ -150,21 +154,21 @@ void AuthenticationManager::clearAllNonPersistentKeys() {
150154 m_auth_mapper.clearAllNonPersistentKeys ();
151155}
152156
153- std::string AuthenticationManager::getUIDSafe (const std::string &public_key) const {
157+ std::string AuthenticationManager::getUIDSafe (const std::string &public_key, LogContext log_context ) const {
154158 std::lock_guard<std::mutex> lock (m_lock);
155159
156160 // Try each key type in order
157- std::string uid = m_auth_mapper.getUIDSafe (PublicKeyType::TRANSIENT, public_key);
161+ std::string uid = m_auth_mapper.getUIDSafe (PublicKeyType::TRANSIENT, public_key, log_context );
158162 if (!uid.empty ()) {
159163 return uid;
160164 }
161165
162- uid = m_auth_mapper.getUIDSafe (PublicKeyType::SESSION, public_key);
166+ uid = m_auth_mapper.getUIDSafe (PublicKeyType::SESSION, public_key, log_context );
163167 if (!uid.empty ()) {
164168 return uid;
165169 }
166170
167- uid = m_auth_mapper.getUIDSafe (PublicKeyType::PERSISTENT, public_key);
171+ uid = m_auth_mapper.getUIDSafe (PublicKeyType::PERSISTENT, public_key, log_context );
168172 if (!uid.empty ()) {
169173 return uid;
170174 }
0 commit comments