Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose token_source for observability #610

Merged
merged 1 commit into from
Oct 26, 2023
Merged

Expose token_source for observability #610

merged 1 commit into from
Oct 26, 2023

Conversation

rayluo
Copy link
Collaborator

@rayluo rayluo commented Oct 25, 2023

This will address #602 's first requirement. The successful token acquisition result will have a new key token_source whose value will be idp, cache or broker.

Existing unit test cases have been updated to test this new behavior.

@rayluo rayluo requested a review from bgavrilMS October 25, 2023 08:45
@rayluo rayluo marked this pull request as ready for review October 25, 2023 08:45
@rayluo rayluo linked an issue Oct 25, 2023 that may be closed by this pull request
3 tasks
msal/application.py Outdated Show resolved Hide resolved
tests/test_application.py Show resolved Hide resolved
@@ -63,6 +63,7 @@
result = global_app.acquire_token_for_client(scopes=config["scope"])

if "access_token" in result:
print("Token was obtain from:", result["token_source"]) # Since MSAL 1.25

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information

This expression logs [sensitive data (secret)](1) as clear text.
@@ -62,6 +62,7 @@
result = global_app.acquire_token_for_client(scopes=config["scope"])

if "access_token" in result:
print("Token was obtain from:", result["token_source"]) # Since MSAL 1.25

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information

This expression logs [sensitive data (secret)](1) as clear text.
@@ -84,6 +84,7 @@
# and then keep calling acquire_token_by_device_flow(flow) in your own customized loop.

if "access_token" in result:
print("Token was obtain from:", result["token_source"]) # Since MSAL 1.25

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information

This expression logs [sensitive data (secret)](1) as clear text.
@@ -79,6 +79,7 @@
)

if "access_token" in result:
print("Token was obtain from:", result["token_source"]) # Since MSAL 1.25

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information

This expression logs [sensitive data (secret)](1) as clear text.
@@ -66,6 +66,7 @@
config["username"], config["password"], scopes=config["scope"])

if "access_token" in result:
print("Token was obtain from:", result["token_source"]) # Since MSAL 1.25

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information

This expression logs [sensitive data (secret)](1) as clear text.
@@ -125,6 +125,7 @@
result = global_app.acquire_token_for_client(scopes=config["scope"])

if "access_token" in result:
print("Token was obtain from:", result["token_source"]) # Since MSAL 1.25

Check failure

Code scanning / CodeQL

Clear-text logging of sensitive information

This expression logs [sensitive data (secret)](1) as clear text.
@rayluo rayluo merged commit b3b2195 into dev Oct 26, 2023
9 checks passed
@rayluo rayluo deleted the token-source branch October 26, 2023 23:56
@rayluo rayluo mentioned this pull request Nov 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature Request] Improve default token caching
2 participants