Skip to content

Commit 42756d2

Browse files
authored
Switching to Lab App for OBO testing (#163)
1 parent 94bc345 commit 42756d2

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

tests/test_e2e.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -412,22 +412,22 @@ def test_adfs2019_onprem_acquire_token_by_auth_code(self):
412412
self.assertCacheWorksForUser(result, scopes, username=None)
413413

414414
@unittest.skipUnless(
415-
os.getenv("OBO_CLIENT_SECRET"),
416-
"Need OBO_CLIENT_SECRET from https://buildautomation.vault.azure.net/secrets/IdentityDivisionDotNetOBOServiceSecret")
415+
os.getenv("LAB_OBO_CLIENT_SECRET"),
416+
"Need LAB_OBO_CLIENT SECRET from https://msidlabs.vault.azure.net/secrets/TodoListServiceV2-OBO/c58ba97c34ca4464886943a847d1db56")
417417
def test_acquire_token_obo(self):
418418
# Some hardcoded, pre-defined settings
419-
obo_client_id = "23c64cd8-21e4-41dd-9756-ab9e2c23f58c"
420-
downstream_scopes = ["https://graph.microsoft.com/User.Read"]
419+
obo_client_id = "f4aa5217-e87c-42b2-82af-5624dd14ee72"
420+
downstream_scopes = ["https://graph.microsoft.com/.default"]
421421
config = self.get_lab_user(usertype="cloud")
422422

423423
# 1. An app obtains a token representing a user, for our mid-tier service
424424
pca = msal.PublicClientApplication(
425-
"be9b0186-7dfd-448a-a944-f771029105bf", authority=config.get("authority"))
425+
"c0485386-1e9a-4663-bc96-7ab30656de7f", authority=config.get("authority"))
426426
pca_result = pca.acquire_token_by_username_password(
427427
config["username"],
428428
self.get_lab_user_secret(config["lab_name"]),
429429
scopes=[ # The OBO app's scope. Yours might be different.
430-
"%s/access_as_user" % obo_client_id],
430+
"api://%s/read" % obo_client_id],
431431
)
432432
self.assertIsNotNone(
433433
pca_result.get("access_token"),
@@ -436,7 +436,7 @@ def test_acquire_token_obo(self):
436436
# 2. Our mid-tier service uses OBO to obtain a token for downstream service
437437
cca = msal.ConfidentialClientApplication(
438438
obo_client_id,
439-
client_credential=os.getenv("OBO_CLIENT_SECRET"),
439+
client_credential=os.getenv("LAB_OBO_CLIENT_SECRET"),
440440
authority=config.get("authority"),
441441
# token_cache= ..., # Default token cache is all-tokens-store-in-memory.
442442
# That's fine if OBO app uses short-lived msal instance per session.

0 commit comments

Comments
 (0)