Skip to content

Commit

Permalink
Update logging and mark authorized_clients as deprecated to address…
Browse files Browse the repository at this point in the history
… review comments
  • Loading branch information
NeonDaniel committed Dec 23, 2024
1 parent a31ad5f commit bb3e2fb
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions neon_hana/auth/client_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@
# LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
# NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
from uuid import uuid4

import jwt

from uuid import uuid4
from datetime import datetime
from threading import Lock
from time import time
Expand All @@ -35,6 +35,7 @@
from fastapi.security import HTTPBearer, HTTPAuthorizationCredentials
from jwt import DecodeError, ExpiredSignatureError
from ovos_utils import LOG
from ovos_utils.log import log_deprecation
from pydantic import ValidationError
from token_throttler import TokenThrottler, TokenBucket
from token_throttler.storage import RuntimeStorage
Expand Down Expand Up @@ -87,7 +88,7 @@ def authorized_clients(self) -> Dict[str, AuthenticationResponse]:
known by this instance. NOTE: Refresh tokens are not reliably stored
here and should never be retrievable after generation for security.
"""
# TODO: Is `authorized_clients` useful to track?
log_deprecation("This property is deprecated with no replacement", "1.0.0")
return self._authorized_clients

def _create_tokens(self,
Expand Down Expand Up @@ -188,7 +189,7 @@ def check_registration_request(self, username: str, password: str,
if self._mq_connector:
return self._mq_connector.create_user(new_user)
else:
print("No User Database connected. Return valid registration.")
LOG.debug("No User Database connected. Return valid registration.")
return new_user

def check_auth_request(self, client_id: str, username: str,
Expand Down Expand Up @@ -313,7 +314,7 @@ def _add_token_to_userdb(self, user: User, new_token: HanaToken):
raise ValueError(f"Expected a refresh token, got: "
f"{new_token.purpose}")
if self._mq_connector is None:
print("No MQ Connection to a user database")
LOG.debug("No MQ Connection to a user database")
return
for idx, token in enumerate(user.tokens):
# If the token is already defined, maintain the original
Expand Down

0 comments on commit bb3e2fb

Please sign in to comment.