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,10 @@ 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+ return m_auth_mapper.hasKey (pub_key_type, public_key, log_context );
128131}
129132
130133void AuthenticationManager::migrateKey (const PublicKeyType &from_type,
@@ -150,21 +153,21 @@ void AuthenticationManager::clearAllNonPersistentKeys() {
150153 m_auth_mapper.clearAllNonPersistentKeys ();
151154}
152155
153- std::string AuthenticationManager::getUIDSafe (const std::string &public_key) const {
156+ std::string AuthenticationManager::getUIDSafe (const std::string &public_key, LogContext log_context ) const {
154157 std::lock_guard<std::mutex> lock (m_lock);
155158
156159 // Try each key type in order
157- std::string uid = m_auth_mapper.getUIDSafe (PublicKeyType::TRANSIENT, public_key);
160+ std::string uid = m_auth_mapper.getUIDSafe (PublicKeyType::TRANSIENT, public_key, log_context );
158161 if (!uid.empty ()) {
159162 return uid;
160163 }
161164
162- uid = m_auth_mapper.getUIDSafe (PublicKeyType::SESSION, public_key);
165+ uid = m_auth_mapper.getUIDSafe (PublicKeyType::SESSION, public_key, log_context );
163166 if (!uid.empty ()) {
164167 return uid;
165168 }
166169
167- uid = m_auth_mapper.getUIDSafe (PublicKeyType::PERSISTENT, public_key);
170+ uid = m_auth_mapper.getUIDSafe (PublicKeyType::PERSISTENT, public_key, log_context );
168171 if (!uid.empty ()) {
169172 return uid;
170173 }
0 commit comments