Skip to content

[PM-44925] feat: Add SSO JIT provision finish domain service - #24835

Open
ike-kottlowski wants to merge 2 commits into
mainfrom
auth/add-sso-jit-finish-domain-service-v2
Open

ike-kottlowski wants to merge 2 commits into
mainfrom
auth/add-sso-jit-finish-domain-service-v2

Conversation

@ike-kottlowski

@ike-kottlowski ike-kottlowski commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

🎟️ Tracking

PM-44925

Related: PM-45497, PM-45036

📔 Objective

Add a domain service for the SSO JIT provision finish flows. Later PRs will connect the password, trusted device, and Key Connector paths to this service.

  • Add SsoJitProvisionFinishService and DefaultSsoJitProvisionFinishService in libs/common/src/auth/sso-jit-provision-finish.
    • finishPassword, finishTrustedDevice, and finishKeyConnector each call one SDK registration method and return its response.
    • The SDK selects the endpoint from the pm-34429-invite-link-auto-confirm flag. The service sends accept_organization_invite and does not read the flag.
    • Each method takes a *Params input. The caller supplies the organization public key, so the service depends only on RegisterSdkService.
  • Add SsoJitProvisionFinishApiService. This wrapper calls POST /sso-jit-provision-finish/key-connector for the V1 Key Connector path. A TODO links it to PM-27328 for removal.
  • Register both services in jslib-services.module.ts.
  • Add unit tests for both services.

This PR adds no callers, so it does not change runtime behavior.

Add SsoJitProvisionFinishService in libs/common/auth/sso-jit-provision-finish.
finishPassword, finishTrustedDevice, and finishKeyConnector each call one
SDK registration method and return its response. The SDK chooses the
endpoint from the pm-34429-invite-link-auto-confirm flag, so the service
sends accept_organization_invite and reads no flag. Each method takes a
*Params input. The caller supplies the organization public key, so the
service depends only on RegisterSdkService.

Add SsoJitProvisionFinishApiService, a wrapper around
POST /sso-jit-provision-finish/key-connector for the V1 Key Connector
path. Tag it with PM-27328. Register both services in jslib-services.
@ike-kottlowski ike-kottlowski added ai-review Request a Claude code review t:feature Change Type - Feature Development labels Nov 18, 2026
@ike-kottlowski
ike-kottlowski marked this pull request as ready for review November 18, 2026 15:58
@ike-kottlowski
ike-kottlowski requested a review from a team as a code owner November 18, 2026 15:58
@github-actions

github-actions Bot commented Nov 18, 2026 •

Copy link
Copy Markdown
Contributor

🤖 Bitwarden Claude Code Review

Overall Assessment: APPROVE

This PR adds SsoJitProvisionFinishService / DefaultSsoJitProvisionFinishService in libs/common/src/auth/sso-jit-provision-finish, a thin wrapper over the SDK JIT password, TDE, and Key Connector registration calls. It also adds the V1 Key Connector SsoJitProvisionFinishApiService and its request model, registers both in jslib-services.module.ts, and covers them with unit tests. The latest commit moves each *Params interface into its own file and updates the barrel, as requested in review. The SDK access pattern (registerClient$, then a null check, then using ref = sdk.take()) matches the existing callers, and no callers are added, so runtime behavior does not change.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🎨 : I much prefer to avoid having so many interfaces in one file. Can we pull the params out into their own sibling files please? Also, please eval the use of params vs request - I think we might be a bit more standardized on request throughout the app.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I investigated this, the finding was the SDK uses "*requests" style naming and it makes sense since it is the one calling the API. However, the client here is really just taking data and mapping it to the SDK inputs, but in an effort to avoid primitive obsession we've created input objects for the domain service.

Essentially the client uses a DTO (the param objects here) to get the data to the SDK. But DTO isn't a naming standard in the Clients project but '*param" had some precedent.

re: the separate file for interfaces I was copying from the set-initial-password which holds all the credential interfaces in the same service.

Good to make the change but these were the reasons.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Good to know.

Ok, params is fine then, but I still would ask to keep things separated for easier review of each file.

@ike-kottlowski ike-kottlowski Nov 18, 2026 •

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

*params pulled into their own files and barrel updated. 581d4f4

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

❓ : I think each of these methods should use a private helper to calculate acceptOrganizationInvite vs accepting it from the params?

The service should inject the config service and the organization invite service. It should read the invite auto confirm feature flag and if that's true and if there is an open org invite in state, then acceptOrganizationInvite should be false? That's business logic this service should own, I think. Then we just clean things up by removing the flag check.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Per our out of band, I'll see about adding the implementation call sites so we can see what it would look like.

My hope is that the call sites will already have read and have context on the invite type so they can be trusted to send the correct information, the domain service becomes the new "api service" and it becomes a thin wrapper over the SDK.

I'll get the Password JIT added so we can get a better idea of how to proceed.

@codecov

codecov Bot commented Nov 18, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 74.28571% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 63.22%. Comparing base (f1f76bf) to head (581d4f4).
⚠️ Report is 7 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
.../common/src/auth/sso-jit-provision-finish/index.ts 0.00% 7 Missing ⚠️
libs/angular/src/services/jslib-services.module.ts 0.00% 1 Missing ⚠️
...ovision-finish/sso-jit-provision-finish.service.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #24835      +/-   ##
==========================================
+ Coverage   63.20%   63.22%   +0.02%     
==========================================
  Files        4999     5004       +5     
  Lines      162524   162610      +86     
  Branches    26207    26226      +19     
==========================================
+ Hits       102716   102813      +97     
+ Misses      52835    52815      -20     
- Partials     6973     6982       +9     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ai-review Request a Claude code review t:feature Change Type - Feature Development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants