summaryrefslogtreecommitdiff
path: root/qvisqve/token_router.py
diff options
context:
space:
mode:
Diffstat (limited to 'qvisqve/token_router.py')
-rw-r--r--qvisqve/token_router.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/qvisqve/token_router.py b/qvisqve/token_router.py
index dd01587..911e899 100644
--- a/qvisqve/token_router.py
+++ b/qvisqve/token_router.py
@@ -27,12 +27,14 @@ import qvisqve_secrets
class TokenRouter(qvisqve.Router):
def __init__(self, token_generator, clients):
+ qvisqve.log.log('debug', msg_text='TokenRouter init starts')
super().__init__()
- args = (Clients(clients), token_generator)
+ args = (clients, token_generator)
self._grants = {
'client_credentials': ClientCredentialsGrant(*args),
'authorization_code': AuthorizationCodeGrant(*args),
}
+ qvisqve.log.log('debug', msg_text='TokenRouter created')
def get_routes(self):
return [
@@ -81,8 +83,14 @@ class Grant:
class ClientCredentialsGrant(Grant):
def get_token(self, request, params):
+ qvisqve.log.log(
+ 'debug', msg_text='ClientCredentialGrant.get_token called',
+ request=request, params=params)
+
client_id, client_secret = request.auth
- if not self._clients.is_correct_secret(client_id, client_secret):
+ if not self._clients.is_valid_secret(client_id, client_secret):
+ qvisqve.log.log(
+ 'error', msg_text='Client token request is unauthorized')
return qvisqve.unauthorized_response('Unauthorized')
scope = self._get_scope(params)