File tree Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Expand file tree Collapse file tree 1 file changed +27
-1
lines changed Original file line number Diff line number Diff line change 1010 load_dotenv () # take environment variables from .env.
1111except :
1212 pass
13-
13+ import base64
1414import logging
1515import os
1616import json
@@ -708,6 +708,32 @@ def test_user_account(self):
708708 self ._test_user_account ()
709709
710710
711+ def _data_for_pop (key ):
712+ raw_req_cnf = json .dumps ({"kid" : key , "xms_ksl" : "sw" })
713+ return { # Sampled from Azure CLI's plugin connectedk8s
714+ 'token_type' : 'pop' ,
715+ 'key_id' : key ,
716+ "req_cnf" : base64 .urlsafe_b64encode (raw_req_cnf .encode ('utf-8' )).decode ('utf-8' ).rstrip ('=' ),
717+ # Note: Sending raw_req_cnf without base64 encoding would result in an http 500 error
718+ } # See also https://github.com/Azure/azure-cli-extensions/blob/main/src/connectedk8s/azext_connectedk8s/_clientproxyutils.py#L86-L92
719+
720+
721+ class AtPopWithExternalKeyTestCase (PopWithExternalKeyTestCase ):
722+ EXPECTED_TOKEN_TYPE = "pop"
723+ DATA1 = _data_for_pop ('AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA-AAAAAAAA' ) # Fake key with a certain format and length
724+ DATA2 = _data_for_pop ('BBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBB-BBBBBBBB' ) # Fake key with a certain format and length
725+ SCOPE = [
726+ '6256c85f-0aad-4d50-b960-e6e9b21efe35/.default' , # Azure CLI's connectedk8s plugin uses this
727+ # https://github.com/Azure/azure-cli-extensions/pull/4468/files#diff-a47efa3186c7eb4f1176e07d0b858ead0bf4a58bfd51e448ee3607a5b4ef47f6R116
728+ ]
729+
730+ def test_service_principal (self ):
731+ self ._test_service_principal ()
732+
733+ def test_user_account (self ):
734+ self ._test_user_account ()
735+
736+
711737class WorldWideTestCase (LabBasedTestCase ):
712738
713739 def test_aad_managed_user (self ): # Pure cloud
You can’t perform that action at this time.
0 commit comments