Skip to content

Commit

Permalink
add logging
Browse files Browse the repository at this point in the history
  • Loading branch information
tianj7 committed Apr 9, 2024
1 parent 10000fc commit c981a59
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
7 changes: 7 additions & 0 deletions fence/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,13 @@ def check_endpoint_auth_method(self, method, endpoint):
"""
Only basic auth is supported. If anything else gets added, change this
"""
logger.info("checking endpoint and auth method")
logger.info("method is ")
logger.info(method)
logger.info("endpoint is")
logger.info(endpoint)
logger.info("confidential is ")
logger.info(self.is_confidential)
if endpoint == "token":
protected_types = [ClientAuthType.basic.value, ClientAuthType.post.value]
return (self.is_confidential and method in protected_types) or (
Expand Down
25 changes: 21 additions & 4 deletions fence/oidc/oidc_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,25 @@ def authenticate(self, request, methods, endpoint):
"""
Override method from authlib
"""
client = super(ClientAuthentication, self).authenticate(
request, methods, endpoint
)
logger.info("oidc_server.py cleintAuthentioncatoin authenticate")
logger.info("request is")
logger.info(request)
logger.info("methods are")
logger.info(methods)
logger.info("endpoint is")
logger.info(endpoint)

try:
client = super(ClientAuthentication, self).authenticate(
request, methods, endpoint
)
except AuthlibClientError:
raise InvalidClientError(
"OAuth client failed to authenticate; client ID or secret is"
" missing or incorrect"
)

logger.info("oidc_server.py clientAuthentioncation authenticate complete")
# don't allow confidential clients to not use auth
if client.is_confidential:
m = list(methods)
Expand All @@ -46,9 +62,10 @@ def authenticate(self, request, methods, endpoint):
)
except AuthlibClientError:
raise InvalidClientError(
"OAuth client failed to authenticate; client ID or secret is"
"Confidential OAuth client failed to authenticate; client ID or secret is"
" missing or incorrect"
)

return client


Expand Down

0 comments on commit c981a59

Please sign in to comment.