Skip to content

Commit b2cb908

Browse files
Add path1 confidential client e2e test driver + fix AADAuthority tenantless check
- Add Path1ConfidentialClient.java: mirrors msal-go path1_confidential/main.go - 4 error cases: missing region, /common, /organizations, secret credential - Happy path: acquire mTLS PoP token, print binding cert, cache check, downstream call - PEM loading with PKCS#1/PKCS#8 auto-detect + bundled test cert fallback - Add E2ETestRunner.java: dispatcher; routes path1/path2 args to test drivers - Update Path2ManagedIdentity.java: add static run() method for dispatcher - Update pom.xml: mainClass → E2ETestRunner, add e2e resources dir - Fix AADAuthority.isTenantless: now true for both 'common' and 'organizations' (was only 'common') so validateMtlsPopParameters catches /organizations correctly - Add mtls-test-cert.p12 as bundled e2e resource (no PEM files required for error tests) Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 2dd9fa4 commit b2cb908

File tree

6 files changed

+664
-3
lines changed

6 files changed

+664
-3
lines changed

msal4j-mtls-extensions/pom.xml

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@
2828
<dependency>
2929
<groupId>com.microsoft.azure</groupId>
3030
<artifactId>msal4j</artifactId>
31-
<version>1.23.1</version>
31+
<version>1.24.0</version>
3232
</dependency>
3333

3434
<!-- JNA: calls ncrypt.dll and AttestationClientLib.dll without a compiled JNI DLL -->
@@ -98,6 +98,18 @@
9898
</sources>
9999
</configuration>
100100
</execution>
101+
<execution>
102+
<id>add-e2e-resources</id>
103+
<phase>generate-resources</phase>
104+
<goals><goal>add-resource</goal></goals>
105+
<configuration>
106+
<resources>
107+
<resource>
108+
<directory>src/e2e/resources</directory>
109+
</resource>
110+
</resources>
111+
</configuration>
112+
</execution>
101113
</executions>
102114
</plugin>
103115

@@ -127,7 +139,7 @@
127139
</filters>
128140
<transformers>
129141
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
130-
<mainClass>com.microsoft.aad.msal4j.mtls.e2e.Path2ManagedIdentity</mainClass>
142+
<mainClass>com.microsoft.aad.msal4j.mtls.e2e.E2ETestRunner</mainClass>
131143
</transformer>
132144
</transformers>
133145
</configuration>
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// mTLS PoP E2E Test Runner
2+
//
3+
// Dispatches to path1 (Confidential Client) or path2 (Managed Identity) based on the
4+
// first argument.
5+
//
6+
// Usage:
7+
// java -jar target/msal4j-mtls-extensions-1.0.0-e2e.jar path1 [options]
8+
// java -jar target/msal4j-mtls-extensions-1.0.0-e2e.jar path2 [--attest]
9+
//
10+
// Run with no arguments or --help for usage.
11+
12+
package com.microsoft.aad.msal4j.mtls.e2e;
13+
14+
import java.util.Arrays;
15+
16+
/**
17+
* Entry point for the mTLS PoP end-to-end test suite.
18+
* Dispatches to {@link Path1ConfidentialClient} or {@link Path2ManagedIdentity}.
19+
*/
20+
public class E2ETestRunner {
21+
22+
public static void main(String[] args) throws Exception {
23+
if (args.length == 0 || "--help".equals(args[0]) || "-h".equals(args[0])) {
24+
printUsage();
25+
return;
26+
}
27+
28+
String path = args[0].toLowerCase();
29+
String[] rest = Arrays.copyOfRange(args, 1, args.length);
30+
31+
switch (path) {
32+
case "path1":
33+
Path1ConfidentialClient.run(rest);
34+
break;
35+
case "path2":
36+
Path2ManagedIdentity.run(rest);
37+
break;
38+
default:
39+
System.err.println("Unknown path: " + args[0]);
40+
printUsage();
41+
System.exit(1);
42+
}
43+
}
44+
45+
private static void printUsage() {
46+
System.out.println("msal4j mTLS PoP End-to-End Test Runner");
47+
System.out.println();
48+
System.out.println("Usage:");
49+
System.out.println(" java -jar msal4j-mtls-extensions-*-e2e.jar <path> [options]");
50+
System.out.println();
51+
System.out.println("Paths:");
52+
System.out.println(" path1 Confidential Client (SNI certificate, Azure AD app registration)");
53+
System.out.println(" path2 Managed Identity (IMDSv2, VBS KeyGuard, Azure VM)");
54+
System.out.println();
55+
System.out.println("Path 1 options:");
56+
System.out.println(" --tenant <tenantId> Azure AD tenant ID");
57+
System.out.println(" --client <clientId> Azure AD app (client) ID");
58+
System.out.println(" --region <region> Azure region (default: centraluseuap)");
59+
System.out.println(" --resource <url> Downstream resource (default: https://graph.microsoft.com)");
60+
System.out.println(" --errors-only Run only error-case validation (no Azure credentials needed)");
61+
System.out.println();
62+
System.out.println("Path 2 options:");
63+
System.out.println(" --attest Enable attestation (requires AttestationClientLib.dll on PATH)");
64+
System.out.println();
65+
System.out.println("Examples:");
66+
System.out.println(" java -jar e2e.jar path1 --errors-only");
67+
System.out.println(" java -jar e2e.jar path1 --tenant <tid> --client <cid> --region westus2");
68+
System.out.println(" java -jar e2e.jar path2 --attest");
69+
}
70+
}

0 commit comments

Comments
 (0)