Skip to content

Commit

Permalink
do not call format in logging statements
Browse files Browse the repository at this point in the history
  • Loading branch information
pmarti committed Feb 27, 2019
1 parent 86b05c1 commit 577bfa2
Show file tree
Hide file tree
Showing 10 changed files with 30 additions and 30 deletions.
20 changes: 10 additions & 10 deletions authlib/oauth2/rfc6749/authenticate_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,13 @@ def authenticate_client_secret_basic(query_client, request):
if client.check_token_endpoint_auth_method('client_secret_basic') \
and client.check_client_secret(client_secret):
log.debug(
'Authenticate {} via "client_secret_basic" '
'success'.format(client_id)
'Authenticate %s via "client_secret_basic" '
'success', client_id
)
return client
log.debug(
'Authenticate {} via "client_secret_basic" '
'failed'.format(client_id)
'Authenticate %s via "client_secret_basic" '
'failed', client_id
)


Expand All @@ -83,13 +83,13 @@ def authenticate_client_secret_post(query_client, request):
if client.check_token_endpoint_auth_method('client_secret_post') \
and client.check_client_secret(client_secret):
log.debug(
'Authenticate {} via "client_secret_post" '
'success'.format(client_id)
'Authenticate %s via "client_secret_post" '
'success', client_id
)
return client
log.debug(
'Authenticate {} via "client_secret_post" '
'failed'.format(client_id)
'Authenticate %s via "client_secret_post" '
'failed', client_id
)


Expand All @@ -103,8 +103,8 @@ def authenticate_none(query_client, request):
if client.check_token_endpoint_auth_method('none') \
and client.check_client_type('public'):
log.debug(
'Authenticate {} via "none" '
'success'.format(client_id)
'Authenticate %s via "none" '
'success', client_id
)
return client
log.debug(
Expand Down
8 changes: 4 additions & 4 deletions authlib/oauth2/rfc6749/grants/authorization_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ def validate_authorization_request(self):
# ignore validate for response_type, since it is validated by
# check_authorization_endpoint
client_id = self.request.client_id
log.debug('Validate authorization request of {!r}'.format(client_id))
log.debug('Validate authorization request of %r', client_id)

if client_id is None:
raise InvalidClientError(
Expand Down Expand Up @@ -235,7 +235,7 @@ def validate_token_request(self):
# authenticate the client if client authentication is included
client = self.authenticate_token_endpoint_client()

log.debug('Validate token request of {!r}'.format(client))
log.debug('Validate token request of %r', client)
if not client.check_grant_type(self.GRANT_TYPE):
raise UnauthorizedClientError()

Expand All @@ -251,7 +251,7 @@ def validate_token_request(self):
raise InvalidRequestError('Invalid "code" in request.')

# validate redirect_uri parameter
log.debug('Validate token redirect_uri of {!r}'.format(client))
log.debug('Validate token redirect_uri of %r', client)
redirect_uri = self.request.redirect_uri
_redirect_uri = authorization_code.get_redirect_uri()
original_redirect_uri = _redirect_uri or None
Expand Down Expand Up @@ -308,7 +308,7 @@ def create_token_response(self):
scope=scope,
include_refresh_token=client.check_client_type('confidential'),
)
log.debug('Issue token {!r} to {!r}'.format(token, client))
log.debug('Issue token %r to %r', token, client)

self.request.user = user
self.server.save_token(token, self.request)
Expand Down
4 changes: 2 additions & 2 deletions authlib/oauth2/rfc6749/grants/client_credentials.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def validate_token_request(self):
# ignore validate for grant_type, since it is validated by
# check_token_endpoint
client = self.authenticate_token_endpoint_client()
log.debug('Validate token request of {!r}'.format(client))
log.debug('Validate token request of %r', client)

if not client.check_grant_type(self.GRANT_TYPE):
raise UnauthorizedClientError()
Expand Down Expand Up @@ -103,7 +103,7 @@ def create_token_response(self):
scope=self.request.scope,
include_refresh_token=False,
)
log.debug('Issue token {!r} to {!r}'.format(token, client))
log.debug('Issue token %r to %r', token, client)
self.server.save_token(token, self.request)
self.execute_hook('process_token', self, token=token)
return 200, token, self.TOKEN_RESPONSE_HEADER
4 changes: 2 additions & 2 deletions authlib/oauth2/rfc6749/grants/implicit.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ def validate_authorization_request(self):

# The implicit grant type is optimized for public clients
client = self.authenticate_token_endpoint_client()
log.debug('Validate authorization request of {!r}'.format(client))
log.debug('Validate authorization request of %r', client)

response_type = self.request.response_type
if not client.check_response_type(response_type):
Expand Down Expand Up @@ -199,7 +199,7 @@ def create_authorization_response(self, grant_user):
scope=self.request.scope,
include_refresh_token=False
)
log.debug('Grant token {!r} to {!r}'.format(token, client))
log.debug('Grant token %r to %r', token, client)

self.server.save_token(token, self.request)
self.execute_hook('process_token', token=token)
Expand Down
4 changes: 2 additions & 2 deletions authlib/oauth2/rfc6749/grants/refresh_token.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def _validate_request_client(self):
# client that was issued client credentials (or with other
# authentication requirements)
client = self.authenticate_token_endpoint_client()
log.debug('Validate token request of {!r}'.format(client))
log.debug('Validate token request of %r', client)

if client.check_client_type('public'):
raise UnauthorizedClientError()
Expand Down Expand Up @@ -133,7 +133,7 @@ def create_token_response(self):
expires_in=expires_in,
scope=scope,
)
log.debug('Issue token {!r} to {!r}'.format(token, client))
log.debug('Issue token %r to %r', token, client)

self.request.user = user
self.server.save_token(token, self.request)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def validate_token_request(self):
# ignore validate for grant_type, since it is validated by
# check_token_endpoint
client = self.authenticate_token_endpoint_client()
log.debug('Validate token request of {!r}'.format(client))
log.debug('Validate token request of %r', client)

if not client.check_grant_type(self.GRANT_TYPE):
raise UnauthorizedClientError()
Expand All @@ -98,7 +98,7 @@ def validate_token_request(self):
if 'password' not in params:
raise InvalidRequestError('Missing "password" in request.')

log.debug('Authenticate user of {!r}'.format(params['username']))
log.debug('Authenticate user of %r', params['username'])
user = self.authenticate_user(
params['username'],
params['password']
Expand Down Expand Up @@ -143,7 +143,7 @@ def create_token_response(self):
user=self.request.user,
scope=self.request.scope,
)
log.debug('Issue token {!r} to {!r}'.format(token, client))
log.debug('Issue token %r to %r', token, client)
self.server.save_token(token, self.request)
self.execute_hook('process_token', token=token)
return 200, token, self.TOKEN_RESPONSE_HEADER
Expand Down
4 changes: 2 additions & 2 deletions authlib/oauth2/rfc7523/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def __call__(self, query_client, request):
resolve_key = self.create_resolve_key_func(query_client, request)
self.process_assertion_claims(assertion, resolve_key)
return self.authenticate_client(request.client)
log.debug('Authenticate via "{}" failed'.format(self.CLIENT_AUTH_METHOD))
log.debug('Authenticate via %r failed', self.CLIENT_AUTH_METHOD)

def create_claims_options(self):
"""Create a claims_options for verify JWT payload claims. Developers
Expand Down Expand Up @@ -65,7 +65,7 @@ def process_assertion_claims(self, assertion, resolve_key):
)
claims.validate()
except JoseError as e:
log.debug('Assertion Error: {!r}'.format(e))
log.debug('Assertion Error: %r', e)
raise InvalidClientError()
return claims

Expand Down
6 changes: 3 additions & 3 deletions authlib/oauth2/rfc7523/grant.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def process_assertion_claims(self, assertion):
try:
claims.validate()
except JoseError as e:
log.debug('Assertion Error: {!r}'.format(e))
log.debug('Assertion Error: %r', e)
raise InvalidGrantError(description=e.description)
return claims

Expand Down Expand Up @@ -94,7 +94,7 @@ def validate_token_request(self):

claims = self.process_assertion_claims(assertion)
client = self.authenticate_client(claims)
log.debug('Validate token request of {!r}'.format(client))
log.debug('Validate token request of %s', client)

if not client.check_grant_type(self.GRANT_TYPE):
raise UnauthorizedClientError()
Expand All @@ -113,7 +113,7 @@ def create_token_response(self):
scope=self.request.scope,
include_refresh_token=False,
)
log.debug('Issue token {!r} to {!r}'.format(token, client))
log.debug('Issue token %r to %r', token, client)
self.server.save_token(token, self.request)
return 200, token, self.TOKEN_RESPONSE_HEADER

Expand Down
2 changes: 1 addition & 1 deletion authlib/oidc/core/grants/hybrid.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def _create_granted_params(self, grant_user):

response_types = self.request.response_type.split()
if 'token' in response_types:
log.debug('Grant token {!r} to {!r}'.format(token, client))
log.debug('Grant token %r to %r', token, client)
self.server.save_token(token, self.request)
if 'id_token' in response_types:
token = self._process_implicit_token(token, code)
Expand Down
2 changes: 1 addition & 1 deletion authlib/oidc/core/grants/implicit.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ def create_authorization_response(self, grant_user):
}
token = self._process_implicit_token(token)
else:
log.debug('Grant token {!r} to {!r}'.format(token, client))
log.debug('Grant token %r to %r', token, client)
self.server.save_token(token, self.request)
token = self._process_implicit_token(token)
params = [(k, token[k]) for k in token]
Expand Down

0 comments on commit 577bfa2

Please sign in to comment.