Skip to content

Commit 7da8f43

Browse files
committed
Rebase to latest FIC/FMI changes
1 parent ce059ae commit 7da8f43

1 file changed

Lines changed: 27 additions & 27 deletions

File tree

  • msal4j-sdk/src/integrationtest/java/com/microsoft/aad/msal4j

msal4j-sdk/src/integrationtest/java/com/microsoft/aad/msal4j/AgenticIT.java

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -300,17 +300,17 @@ void acquireTokenForAgent_withUpn_fullFlow() throws Exception {
300300
IClientCertificate clientCert = ClientCredentialFactory.createFromCertificate(privateKey, certificate);
301301

302302
ConfidentialClientApplication blueprintCca = ConfidentialClientApplication.builder(
303-
BLUEPRINT_CLIENT_ID, clientCert)
303+
TestConstants.AGENTIC_BLUEPRINT_CLIENT_ID, clientCert)
304304
.authority(AUTHORITY)
305305
.sendX5c(true)
306-
.azureRegion(AZURE_REGION)
306+
.azureRegion(TestConstants.AGENTIC_AZURE_REGION)
307307
.build();
308308

309-
AgentIdentity agentId = AgentIdentity.withUsername(AGENT_APP_ID, USER_UPN);
309+
AgentIdentity agentId = AgentIdentity.withUsername(TestConstants.AGENTIC_AGENT_APP_ID, TestConstants.AGENTIC_USER_UPN);
310310

311311
IAuthenticationResult result = blueprintCca.acquireTokenForAgent(
312312
AcquireTokenForAgentParameters.builder(
313-
Collections.singleton(GRAPH_SCOPE), agentId).build()
313+
Collections.singleton(TestConstants.AGENTIC_GRAPH_SCOPE), agentId).build()
314314
).get();
315315

316316
assertNotNull(result, "Result should not be null");
@@ -328,17 +328,17 @@ void acquireTokenForAgent_appOnly() throws Exception {
328328
IClientCertificate clientCert = ClientCredentialFactory.createFromCertificate(privateKey, certificate);
329329

330330
ConfidentialClientApplication blueprintCca = ConfidentialClientApplication.builder(
331-
BLUEPRINT_CLIENT_ID, clientCert)
331+
TestConstants.AGENTIC_BLUEPRINT_CLIENT_ID, clientCert)
332332
.authority(AUTHORITY)
333333
.sendX5c(true)
334-
.azureRegion(AZURE_REGION)
334+
.azureRegion(TestConstants.AGENTIC_AZURE_REGION)
335335
.build();
336336

337-
AgentIdentity agentId = AgentIdentity.appOnly(AGENT_APP_ID);
337+
AgentIdentity agentId = AgentIdentity.appOnly(TestConstants.AGENTIC_AGENT_APP_ID);
338338

339339
IAuthenticationResult result = blueprintCca.acquireTokenForAgent(
340340
AcquireTokenForAgentParameters.builder(
341-
Collections.singleton(GRAPH_SCOPE), agentId).build()
341+
Collections.singleton(TestConstants.AGENTIC_GRAPH_SCOPE), agentId).build()
342342
).get();
343343

344344
assertNotNull(result, "Result should not be null");
@@ -355,33 +355,33 @@ void acquireTokenForAgent_forceRefresh() throws Exception {
355355
IClientCertificate clientCert = ClientCredentialFactory.createFromCertificate(privateKey, certificate);
356356

357357
ConfidentialClientApplication blueprintCca = ConfidentialClientApplication.builder(
358-
BLUEPRINT_CLIENT_ID, clientCert)
358+
TestConstants.AGENTIC_BLUEPRINT_CLIENT_ID, clientCert)
359359
.authority(AUTHORITY)
360360
.sendX5c(true)
361-
.azureRegion(AZURE_REGION)
361+
.azureRegion(TestConstants.AGENTIC_AZURE_REGION)
362362
.build();
363363

364-
AgentIdentity agentId = AgentIdentity.withUsername(AGENT_APP_ID, USER_UPN);
364+
AgentIdentity agentId = AgentIdentity.withUsername(TestConstants.AGENTIC_AGENT_APP_ID, TestConstants.AGENTIC_USER_UPN);
365365

366366
// First call — populates cache
367367
IAuthenticationResult result1 = blueprintCca.acquireTokenForAgent(
368368
AcquireTokenForAgentParameters.builder(
369-
Collections.singleton(GRAPH_SCOPE), agentId).build()
369+
Collections.singleton(TestConstants.AGENTIC_GRAPH_SCOPE), agentId).build()
370370
).get();
371371
assertNotNull(result1.accessToken());
372372

373373
// Second call without forceRefresh — should return cached token
374374
IAuthenticationResult result2 = blueprintCca.acquireTokenForAgent(
375375
AcquireTokenForAgentParameters.builder(
376-
Collections.singleton(GRAPH_SCOPE), agentId).build()
376+
Collections.singleton(TestConstants.AGENTIC_GRAPH_SCOPE), agentId).build()
377377
).get();
378378
assertEquals(result1.accessToken(), result2.accessToken(),
379379
"Second call should return cached token");
380380

381381
// Third call with forceRefresh — should get a fresh token
382382
IAuthenticationResult result3 = blueprintCca.acquireTokenForAgent(
383383
AcquireTokenForAgentParameters.builder(
384-
Collections.singleton(GRAPH_SCOPE), agentId)
384+
Collections.singleton(TestConstants.AGENTIC_GRAPH_SCOPE), agentId)
385385
.forceRefresh(true).build()
386386
).get();
387387
assertNotNull(result3.accessToken());
@@ -397,25 +397,25 @@ void acquireTokenForAgent_cacheIsolation_twoBlueprintCcas() throws Exception {
397397
IClientCertificate clientCert = ClientCredentialFactory.createFromCertificate(privateKey, certificate);
398398

399399
ConfidentialClientApplication blueprint1 = ConfidentialClientApplication.builder(
400-
BLUEPRINT_CLIENT_ID, clientCert)
400+
TestConstants.AGENTIC_BLUEPRINT_CLIENT_ID, clientCert)
401401
.authority(AUTHORITY)
402402
.sendX5c(true)
403-
.azureRegion(AZURE_REGION)
403+
.azureRegion(TestConstants.AGENTIC_AZURE_REGION)
404404
.build();
405405

406406
ConfidentialClientApplication blueprint2 = ConfidentialClientApplication.builder(
407-
BLUEPRINT_CLIENT_ID, clientCert)
407+
TestConstants.AGENTIC_BLUEPRINT_CLIENT_ID, clientCert)
408408
.authority(AUTHORITY)
409409
.sendX5c(true)
410-
.azureRegion(AZURE_REGION)
410+
.azureRegion(TestConstants.AGENTIC_AZURE_REGION)
411411
.build();
412412

413-
AgentIdentity agentId = AgentIdentity.withUsername(AGENT_APP_ID, USER_UPN);
413+
AgentIdentity agentId = AgentIdentity.withUsername(TestConstants.AGENTIC_AGENT_APP_ID, TestConstants.AGENTIC_USER_UPN);
414414

415415
// Acquire via blueprint1
416416
IAuthenticationResult result1 = blueprint1.acquireTokenForAgent(
417417
AcquireTokenForAgentParameters.builder(
418-
Collections.singleton(GRAPH_SCOPE), agentId).build()
418+
Collections.singleton(TestConstants.AGENTIC_GRAPH_SCOPE), agentId).build()
419419
).get();
420420
assertNotNull(result1.accessToken());
421421

@@ -428,7 +428,7 @@ void acquireTokenForAgent_cacheIsolation_twoBlueprintCcas() throws Exception {
428428
// Acquire via blueprint2
429429
IAuthenticationResult result2 = blueprint2.acquireTokenForAgent(
430430
AcquireTokenForAgentParameters.builder(
431-
Collections.singleton(GRAPH_SCOPE), agentId).build()
431+
Collections.singleton(TestConstants.AGENTIC_GRAPH_SCOPE), agentId).build()
432432
).get();
433433
assertNotNull(result2.accessToken());
434434

@@ -446,17 +446,17 @@ void acquireTokenForAgent_upnThenOid_sharesCache() throws Exception {
446446
IClientCertificate clientCert = ClientCredentialFactory.createFromCertificate(privateKey, certificate);
447447

448448
ConfidentialClientApplication blueprintCca = ConfidentialClientApplication.builder(
449-
BLUEPRINT_CLIENT_ID, clientCert)
449+
TestConstants.AGENTIC_BLUEPRINT_CLIENT_ID, clientCert)
450450
.authority(AUTHORITY)
451451
.sendX5c(true)
452-
.azureRegion(AZURE_REGION)
452+
.azureRegion(TestConstants.AGENTIC_AZURE_REGION)
453453
.build();
454454

455455
// Step 1: Acquire via UPN
456-
AgentIdentity upnIdentity = AgentIdentity.withUsername(AGENT_APP_ID, USER_UPN);
456+
AgentIdentity upnIdentity = AgentIdentity.withUsername(TestConstants.AGENTIC_AGENT_APP_ID, TestConstants.AGENTIC_USER_UPN);
457457
IAuthenticationResult upnResult = blueprintCca.acquireTokenForAgent(
458458
AcquireTokenForAgentParameters.builder(
459-
Collections.singleton(GRAPH_SCOPE), upnIdentity).build()
459+
Collections.singleton(TestConstants.AGENTIC_GRAPH_SCOPE), upnIdentity).build()
460460
).get();
461461
assertNotNull(upnResult.account(), "Account should not be null");
462462

@@ -469,10 +469,10 @@ void acquireTokenForAgent_upnThenOid_sharesCache() throws Exception {
469469
java.util.UUID userOid = java.util.UUID.fromString(oidString);
470470

471471
// Step 2: Acquire via OID — should come from cache
472-
AgentIdentity oidIdentity = new AgentIdentity(AGENT_APP_ID, userOid);
472+
AgentIdentity oidIdentity = new AgentIdentity(TestConstants.AGENTIC_AGENT_APP_ID, userOid);
473473
IAuthenticationResult oidResult = blueprintCca.acquireTokenForAgent(
474474
AcquireTokenForAgentParameters.builder(
475-
Collections.singleton(GRAPH_SCOPE), oidIdentity).build()
475+
Collections.singleton(TestConstants.AGENTIC_GRAPH_SCOPE), oidIdentity).build()
476476
).get();
477477

478478
// Should return the same cached token

0 commit comments

Comments
 (0)