Repository navigation
[PM-44925] feat: Add SSO JIT provision finish domain service - #24835
ike-kottlowski wants to merge 2 commits into
Conversation
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.
🤖 Bitwarden Claude Code ReviewOverall Assessment: APPROVE This PR adds |
There was a problem hiding this comment.
🎨 : 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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
Good to know.
Ok, params is fine then, but I still would ask to keep things separated for easier review of each file.
There was a problem hiding this comment.
*params pulled into their own files and barrel updated. 581d4f4
There was a problem hiding this comment.
❓ : 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.
There was a problem hiding this comment.
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 Report❌ Patch coverage is 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. 🚀 New features to boost your workflow:
|
🎟️ 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.
SsoJitProvisionFinishServiceandDefaultSsoJitProvisionFinishServiceinlibs/common/src/auth/sso-jit-provision-finish.finishPassword,finishTrustedDevice, andfinishKeyConnectoreach call one SDK registration method and return its response.pm-34429-invite-link-auto-confirmflag. The service sendsaccept_organization_inviteand does not read the flag.*Paramsinput. The caller supplies the organization public key, so the service depends only onRegisterSdkService.SsoJitProvisionFinishApiService. This wrapper callsPOST /sso-jit-provision-finish/key-connectorfor the V1 Key Connector path. A TODO links it to PM-27328 for removal.jslib-services.module.ts.This PR adds no callers, so it does not change runtime behavior.