Skip to content
Open
Show file tree
Hide file tree
Changes from 84 commits
Commits
Show all changes
87 commits
Select commit Hold shift + click to select a range
26aff0c
Add Native Auth V2 (server-driven HAL) SDK with SSPR wired end-to-end
spetrescu84 Jun 30, 2026
51e0626
hal responses
spetrescu84 Jun 30, 2026
e90c15f
other flows - sign-in/sign-up, parsing urls properly
spetrescu84 Jun 30, 2026
c72464b
url resolver
spetrescu84 Jun 30, 2026
365df84
Updates for error handling and proper signin response
spetrescu84 Jul 1, 2026
f5cb672
parse token
spetrescu84 Jul 1, 2026
90bcb7f
Fix sending attributes
spetrescu84 Jul 2, 2026
6a9af74
Move HAL to MSAL
spetrescu84 Jul 6, 2026
2e74940
v2 client_info and parameters and scopes
spetrescu84 Jul 6, 2026
1f5e017
Reorder items in PublicClientApplication
spetrescu84 Jul 7, 2026
48ef139
flow controller swiftlint
spetrescu84 Jul 10, 2026
645db2b
Swiftlint
spetrescu84 Jul 10, 2026
2590b88
comments
spetrescu84 Jul 10, 2026
17e18ed
Native Auth V2: early link validation, non-optional hrefs, method ord…
spetrescu84 Jul 10, 2026
77810a0
decode response and fail rther than failing on next request
spetrescu84 Jul 10, 2026
78e2ac8
Removed static and Self. calls
spetrescu84 Jul 13, 2026
ce51bab
Fail fast on missing authorize-challenge link; thread flowType into V…
spetrescu84 Jul 13, 2026
4d55fc3
Added ApiId for each endpoint that is the same
spetrescu84 Jul 13, 2026
75d5f23
Refine V2 flow controller: naming, hint fallback, and per-link error …
spetrescu84 Jul 13, 2026
0956214
Extract shared token-response cache persistence into MSALNativeAuthTo…
spetrescu84 Jul 13, 2026
15ec8dd
Deduplicate native-auth controllers and wire HAL isError propagation
spetrescu84 Jul 13, 2026
396d7e7
Drop redundant HAL isError in favor of direct error binding
spetrescu84 Jul 13, 2026
1de98f6
MFA
spetrescu84 Jul 15, 2026
6b44812
SignUp changes
spetrescu84 Jul 16, 2026
17cc92c
Native Auth V2: sign-up attribute autofill + otp verify fixes
spetrescu84 Jul 16, 2026
8c380d4
Merge origin/sedemche/native-auth-v2_release into origin/spetrescu/na…
spetrescu84 Jul 16, 2026
5fb022d
Alignment for v1 and v2 interfaces for parameters and SOLID principles
spetrescu84 Jul 21, 2026
b4a4500
Refactor V2 native-auth to use typed key enums (V1-style)
spetrescu84 Jul 21, 2026
d9ee86b
Introduce typed body for V2 native-auth HAL follow-up requests
spetrescu84 Jul 21, 2026
c616084
Add context-threaded, PII-masked logging to V2 native-auth validator …
spetrescu84 Jul 21, 2026
574e3e0
Add version control rule: never commit or push without explicit user …
spetrescu84 Jul 21, 2026
78ac89a
Fix V2 FlowController completion tests and resolve SwiftLint issues
spetrescu84 Jul 21, 2026
8c495d0
Merge branch 'dev' into spetrescu/native-auth-v2
spetrescu84 Jul 21, 2026
f4c100f
merged dev into branch
spetrescu84 Jul 21, 2026
608c98a
Revert "merged dev into branch"
spetrescu84 Jul 21, 2026
8753280
Correct IC
spetrescu84 Jul 21, 2026
32094fc
Revert "Correct IC"
spetrescu84 Jul 21, 2026
bf2b80e
removed not needed cache accessor
spetrescu84 Jul 21, 2026
0d127ad
not needed comment
spetrescu84 Jul 21, 2026
3f21006
Comments
spetrescu84 Jul 22, 2026
ab433a1
Unify V2 continuation-state links behind a typed LinkKey
spetrescu84 Jul 22, 2026
a74b7ac
Remove KVC body hack from V2 request configurator
spetrescu84 Jul 22, 2026
00c6ccc
Updates to code guides
spetrescu84 Jul 22, 2026
0fd300f
Removed rule from agents.md
spetrescu84 Jul 22, 2026
5026f8d
removed not necessary imports
spetrescu84 Jul 22, 2026
96fca30
Avoid non-Sendable captures in native-auth request continuations
spetrescu84 Jul 22, 2026
27cbbfb
Removed not necessary imports
spetrescu84 Jul 22, 2026
839f384
Renamed makeV2FlowController to makeFlowController
spetrescu84 Jul 22, 2026
6815fa5
Removed import
spetrescu84 Jul 22, 2026
a8432ee
Route reset-password challenge/resend through server-driven mapIntera…
spetrescu84 Jul 22, 2026
5dbbbe9
Route reset-password code verification through server-driven mapInter…
spetrescu84 Jul 22, 2026
a0b18d8
MFA
spetrescu84 Jul 22, 2026
18a1408
Treat invalid continuation token as a general error
spetrescu84 Jul 22, 2026
606a0be
Comments
spetrescu84 Jul 22, 2026
c69737e
Comment
spetrescu84 Jul 22, 2026
1bbbdab
Remove unused V2 HAL token validator
spetrescu84 Jul 22, 2026
2fa2181
Fold sign-in method discovery into the interaction action switch
spetrescu84 Jul 22, 2026
9438988
Comments
spetrescu84 Jul 22, 2026
8ec1d8a
Comments
spetrescu84 Jul 22, 2026
48727b8
Comments
spetrescu84 Jul 22, 2026
57547e6
Comment
spetrescu84 Jul 22, 2026
2945caf
comment
spetrescu84 Jul 22, 2026
af477fa
Map password policy and credentials errors in V2 flow error mapper
spetrescu84 Jul 22, 2026
9ce847f
Merge branch 'sedemche/native-auth-v2_release' into spetrescu/native-…
spetrescu84 Jul 23, 2026
948f61b
Replace native-auth V2 action enum with concrete states and server-dr…
spetrescu84 Jul 23, 2026
18f46d5
Thread operation apiId into V2 native-auth requests
spetrescu84 Jul 23, 2026
48a173a
Add V2 native-auth network unit tests and fix stale controller test
spetrescu84 Jul 23, 2026
71700ae
Add V2 native-auth Tier 1 tests: FlowError, dispatcher, HAL serialize…
spetrescu84 Jul 23, 2026
1711f5b
Remove non sspr
spetrescu84 Jul 23, 2026
2bfaf0b
moved RetryExecutor to main to use in poll SSPR
spetrescu84 Jul 27, 2026
0a2b0a4
setup MSALNativeAuthFlowScenario as case iterable
spetrescu84 Jul 27, 2026
29f5e8d
remove not used cache accessor
spetrescu84 Jul 27, 2026
b400f53
Removed deprecated messages
spetrescu84 Jul 27, 2026
8e77419
made mapInteraction testable and added tests
spetrescu84 Jul 27, 2026
86394ce
Add redirect back
spetrescu84 Jul 27, 2026
2237fe6
Added clarification comment
spetrescu84 Jul 27, 2026
c83c369
Rename V2 response validator to parser
spetrescu84 Jul 27, 2026
baf9a91
Add todo to MSALNativeAuthV2HrefURLResolver
spetrescu84 Jul 28, 2026
e75d8ab
Make V2 LinkRelation an extensible struct and prune unused relations
spetrescu84 Jul 29, 2026
9edc2d3
Moved all endpoints into one enum
spetrescu84 Jul 29, 2026
010291b
Update flow controller to remove mapInteraction
spetrescu84 Jul 29, 2026
9e04a46
removed TokenCacher and moved to MSALNativeAuthCacheInterface
spetrescu84 Jul 29, 2026
77bbc6c
Split MSALNativeAuthV2RequestBody into per request
spetrescu84 Jul 29, 2026
7f08618
Split MSALNativeAuthHALResponse by request
spetrescu84 Jul 29, 2026
5cce4cf
Fix build issues
spetrescu84 Jul 30, 2026
caecbd4
Update HalAction
spetrescu84 Jul 31, 2026
c6f3d1b
First check for error before guard poll
spetrescu84 Jul 31, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
81 changes: 81 additions & 0 deletions .clinerules/04-Code-style-guidelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -555,3 +555,84 @@ All new files **MUST** include the Microsoft copyright header when added to this
## Notes

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This pull request does not update CHANGELOG.md.

Please consider if this change would be noticeable to a partner or user and either update CHANGELOG.md or resolve this conversation.


This style guide is adapted specifically for AI agents working on the Microsoft Authentication Library (MSAL) for iOS and macOS. When in doubt, prioritize consistency with existing codebase patterns over strict adherence to external style guides.

---

## Swift Style (native_auth)

The Swift code under `MSAL/src/native_auth`) **MUST** follow the SwiftLint rules from `MSAL/.swiftlint.yml`.

### SwiftLint configuration (source of truth: `MSAL/.swiftlint.yml`)

- `line_length`: warning at **150** columns.
- `type_name`: max length **60**.
- `function_parameter_count`: warning at **7**.
- Disabled rules: `todo`, `empty_enum_arguments`.
- Default limits apply for `function_body_length` (**50**), `cyclomatic_complexity` (**10**), `file_length`, and `type_body_length`.

Changed native_auth Swift files **MUST** lint clean (zero warnings) before completion:

```bash
swiftlint lint --quiet MSAL/src/native_auth/<changed-file>.swift
```

### Line length — WRAP, don't suppress

When a call or declaration exceeds 150 columns, **wrap it** — put each argument on its own line, indented 4 spaces beyond the call, with the closing paren on its own line.

```swift
return await mapInteraction(
startResult,
flowType: .signIn,
username: parameters.username,
scopes: scopes,
event: event,
context: context
)
```

Wrap long ternaries, `makeState(...)`, `response(.actionRequired(...))`, and `try self.requestProvider.foo(...)` calls the same way. For a long nested constructor, break the inner initializer onto its own lines too:

```swift
return failure(
.error(MSALNativeAuthFlowError(
kind: .generalError,
errorDescription: "No usable sign-in method returned"
)),
event: event,
context: context
)
```

**Only** suppress `line_length` inline — `// swiftlint:disable:this line_length` — for an un-wrappable single string literal (log/error message). Never use it to avoid wrapping ordinary code.

### Method / call declaration formatting

- One parameter per line when a declaration exceeds the line limit; closing paren and `-> ReturnType` on their own line.
- 4-space indentation, never tabs.

### function_body_length & cyclomatic_complexity — prefer suppression over refactor

Long orchestration methods that legitimately exceed the 50-line body limit should suppress the warning rather than fragmenting the logic across helpers. Do **not** refactor control flow purely to satisfy the linter.

- Add the suppression on the line immediately above the `func`:

```swift
// swiftlint:disable:next function_body_length
private func handleResponse(...) { ... }
```

- When a function trips **both** rules, combine them on one line (see `MSALNativeAuthTokenResponseValidator.swift`):

```swift
// swiftlint:disable:next cyclomatic_complexity function_body_length
func validate(...) { ... }
```

- For file- or type-level limits, use the block form at the top of the file / above the type:

```swift
// swiftlint:disable file_length
// swiftlint:disable:next type_body_length
final class MSALNativeAuth...Controller { ... }
```
8 changes: 8 additions & 0 deletions .clinerules/AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,14 @@ When creating a new application with MSAL authentication, users need to select a
| **Authority Endpoint** | Uses tenant ID or common | Uses tenant subdomain |
| **Use Cases** | Enterprise apps, B2E scenarios | Consumer apps, B2C scenarios |

## Build and test guidelines

AI agents MUST build and run tests using the build/test configuration already set up in Xcode — i.e. the schemes defined in `MSAL.xcworkspace`, driven through `build.py` (e.g. `./build.py --targets iosFramework macFramework`). Always use `MSAL.xcworkspace`, never open or build `MSAL.xcodeproj` directly, and do not invent ad-hoc `xcodebuild` invocations, schemes, or configurations that diverge from the ones configured in the workspace. If a build/test run needs a specific simulator, select an available one via the `IOS_SIM_DEVICE` / `IOS_SIM_OS` environment variables (consumed by `build.py`) rather than changing the scheme or configuration.

## Version control guidelines

AI agents MUST NOT run `git commit`, `git push`, or any other history- or remote-mutating git command unless the user has explicitly asked for it in the current request. Make and stage changes, then stop and let the user review; wait for an explicit instruction before committing or pushing. Never commit or push proactively "to be helpful" — the user always reviews changes first.

## MSAL API usage

Sample code snippets for both Swift & Objective-C can be found in the file `.clinerules/03-MSAL-API-usage.md`
Expand Down
1 change: 1 addition & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ Public headers MUST be in:
5. **Prefixes:** `MSAL` for public classes, `MSID` for IdentityCore internal
6. **Properties over ivars:** Use `@property` declarations
7. **Swift lint:** Native auth code must pass SwiftLint (line length: 150)
8. **Comments:** Only comment non-obvious rationale. Don't add comments that explain what the code already explains.

**Example:**

Expand Down
Loading
Loading