You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This repository does not define a dedicated lint command.
25
+
24
26
## Architecture
25
27
26
28
- The solution combines a C++17 console application, a framework-dependent `net8.0` authentication component, and xUnit tests for the managed validation layer.
@@ -29,6 +31,8 @@ dotnet test MipAuth.Managed.Tests\MipAuth.Managed.Tests.csproj -c Release --no-b
29
31
-`AuthDelegateImpl` forwards every MIP OAuth challenge field--authority, resource, and claims--to `sample::auth::AcquireToken`.
30
32
-`auth.cpp` hosts .NET in-process through `nethost`/`hostfxr`. A process-wide `ManagedRuntime` loads `MipAuth.Managed.dll` and its runtime config from the native executable directory and resolves `MipAuth.Managed.EntryPoint.AcquireToken`.
31
33
-`MipAuth.Managed` validates the native request, normalizes approved Microsoft Entra authority and Azure Rights Management resource hosts, converts the resource to a `/.default` scope, then uses MSAL cache-first authentication for the exact username before system-browser interactive sign-in.
34
+
- Consent is implemented through `ConsentDelegateImpl` and is intentionally non-interactive in this sample (defaults to `Consent::Accept`) so the core protection flow can run without an extra prompt.
35
+
- The consent delegate callback is primarily relevant for AD RMS/on-prem service connectivity. Cloud-service calls may still traverse this flow in AD RMS-capable environments; keep this delegate behavior only in apps that need AD RMS support.
32
36
- The native project's `CopyManagedAuth` target copies the managed assembly, `.deps.json`, `.runtimeconfig.json`, managed dependencies, and `nethost.dll` beside the x64 executable. Do not replace this with external-process, file, stdout, or console IPC.
33
37
34
38
## Repository-specific conventions
@@ -37,6 +41,8 @@ dotnet test MipAuth.Managed.Tests\MipAuth.Managed.Tests.csproj -c Release --no-b
37
41
- Keep native hosting on the v143 toolset, C++17, MIP Protection SDK `1.18.124`, and `Microsoft.NETCore.App.Host.win-x64``8.0.29` unless intentionally updating every corresponding `packages.config`, `.vcxproj`, and deployment reference.
38
42
- The C++ `AuthRequest` and C# `AuthRequest` are one ABI contract: sequential field order and types, version `1`, native size `120`, UTF-8 pointer/length pairs, and native-owned 64 KiB token/error buffers. Update both definitions and the guards together.
39
43
- Preserve the managed entry point as `[UnmanagedCallersOnly]` with the `(IntPtr, int) -> int` component ABI. Return `AuthResult` codes and bounded UTF-8 error text across the boundary; do not let exceptions cross it.
44
+
- Keep `AuthResult` values and native expectations aligned. `ValidateManagedHost()` specifically expects the managed `InvalidAuthority` result and `"Invalid authority."` error text.
40
45
- Keep authority/resource validation allowlist-based and strict. Generic authentication errors are intentional, and access tokens must never be logged or written to console/files.
41
46
- Authentication must remain cache-first for a case-insensitive exact username match, then use the system browser. Forward conditional-access claims to both silent and interactive MSAL requests.
42
47
- Managed implementation types are `internal`; tests access them through `InternalsVisibleTo("MipAuth.Managed.Tests")`. Add validation cases to `ValidationTests` when changing accepted authorities, resources, identity rules, or account selection.
48
+
- Keep the sample flow template-based and string-based (`ListTemplates`, `ProtectString`, `DecryptString`). Avoid reintroducing file-labeling/sample-policy semantics from other MIP samples.
0 commit comments