Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 1 addition & 11 deletions msal/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -189,21 +189,11 @@ def _acquire_ssh_cert_interactive(app):
if result.get("token_type") != "ssh-cert":
logging.error("Unable to acquire an ssh-cert")

_POP_KEY_ID = 'AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA-AAAAAAAA' # Fake key with a certain format and length
_RAW_REQ_CNF = json.dumps({"kid": _POP_KEY_ID, "xms_ksl": "sw"})
_POP_DATA = { # Sampled from Azure CLI's plugin connectedk8s
'token_type': 'pop',
'key_id': _POP_KEY_ID,
"req_cnf": base64.urlsafe_b64encode(_RAW_REQ_CNF.encode('utf-8')).decode('utf-8').rstrip('='),
# Note: Sending _RAW_REQ_CNF without base64 encoding would result in an http 500 error
} # See also https://github.com/Azure/azure-cli-extensions/blob/main/src/connectedk8s/azext_connectedk8s/_clientproxyutils.py#L86-L92

def _acquire_pop_token_interactive(app):
"""Acquire a POP token interactively - This typically only works with Azure CLI"""
assert isinstance(app, msal.PublicClientApplication)
POP_SCOPE = ['6256c85f-0aad-4d50-b960-e6e9b21efe35/.default'] # KAP 1P Server App Scope, obtained from https://github.com/Azure/azure-cli-extensions/pull/4468/files#diff-a47efa3186c7eb4f1176e07d0b858ead0bf4a58bfd51e448ee3607a5b4ef47f6R116
result = _acquire_token_interactive(app, scopes=POP_SCOPE, data=_POP_DATA)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you removed _POP_DATA, can you leave some comments/instructions on how to construct POP parameters?
Also, can you validate if the parameters are good in this test?

scopes=[SCOPE_ARM], auth_scheme=placeholder_auth_scheme, data=None, expected_token_type="pop")
interactive_and_silent(

print_json(result)
result = _acquire_token_interactive(app, scopes=POP_SCOPE)
if result.get("token_type") != "pop":
logging.error("Unable to acquire a pop token")
Comment on lines 195 to 198

Expand Down
Loading