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
Copy file name to clipboardExpand all lines: docs/specs/organization/10-use-case.md
+89-3Lines changed: 89 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -644,9 +644,9 @@ Another potential problem is that the User could be a Member of many Organizatio
644
644
> [!IMPORTANT]
645
645
> Should we limit the maximum number of Organizations a User can be a member of? Is 100 a reasonable hard limit?
646
646
647
-
This use case could be essential for implementing Organization Switcher.
647
+
This use case could be essential for implementing Organization Switching.
648
648
649
-
In the Organization Switcher we commonly see in online services,
649
+
In Organization Switching we commonly see in online services,
650
650
the following information are shown
651
651
652
652
- A display name of the Organization. This is different from the Organization Slug.
@@ -914,7 +914,93 @@ Implement Use case 11.1 for MVP.
914
914
915
915
## Use case 12: Built-in Organization Switching
916
916
917
-
TODO
917
+
Before we discuss Organization Switching,
918
+
we first have to acknowledge that all competitors associate a Session with at most 1 Organization.
919
+
920
+
For example, in Use case 7.1, regardless of `x_organization_behavior`,
921
+
the User signs in to 1 Organization, or no Organization.
922
+
923
+
For example, in Use case 8.1, `org_slug` is a string, not an array of strings.
924
+
925
+
### Use case 12.1: Organization Switching in OIDC
926
+
927
+
> [!WARNING]
928
+
> This use case requires Use case 8.2.
929
+
930
+
Among of the competitors,
931
+
only Stytch provides enough support for the developer to implement Organization Switching.
932
+
It support Organization Switching by [Exchange Session](https://stytch.com/docs/b2b/sdks/session-management/exchange-session#exchange-session)
933
+
934
+
> From the developer's point of view, what do they expect to see in the Session list of a User?
935
+
936
+
- User A signs in Organization A via Client A: See Session A in the listing, # Sessions = 1
937
+
- User A switches to Organization B in Session A: See Session A in the listing, # Sessions = 1
938
+
939
+
**The developer expects to revoke Session A to make User A completely signs out of Client A.**
940
+
941
+
> From the developer's point of view, do they expect to see `user.authenticated` fire again when switching Organizations?
942
+
943
+
My gut feeling is No.
944
+
945
+
> From the end-user's point of view, do they expect to be authenticated again if switching to an Organization that has equivalent configuration?
946
+
947
+
No.
948
+
949
+
> From the end-user's point of view, do they expect to be authenticated again if switching to an Organization that has Federated Login?
950
+
951
+
Yes, if the end-user has not done that Federated Login within the same Session before.
952
+
953
+
> From the end-user's point of view, do they expect to be authenticated again if switching back to an Organization that has no Federated Login?
954
+
955
+
No.
956
+
957
+
> From the end-user's point of view, do they expect to be authenticated again if switching back to the Organization that has Federated Login?
958
+
959
+
No, since they have done that already.
960
+
961
+
> From the end-user's point of view, do they expect to be authenticated again if switching to an Organization that requires MFA?
962
+
963
+
Yes, they expect MFA.
964
+
965
+
> From the end-user's point of view, do they expect to be authenticated again if switching back to another Organization, and then switching to the Organization that requires MFA?
966
+
967
+
No, since they have done that already.
968
+
969
+
---
970
+
971
+
The following desirable behaviors can be derived from the above Q&A.
972
+
973
+
- The end-user may expect no user interaction is involved if switching to an already authenticated Organization. This implies a Session should remember what Organizations the User has authenticated to.
974
+
- The developer may expect 2 conflicting behaviors regarding MFA
975
+
- Behavior 1: Organizations have disjoint sets of secondary authenticators. The developer **DOES NOT** care about the actual method. As long as the end-user has done MFA once, the end-user will not be prompted again for MFA when switching Organizations.
976
+
- Behavior 2: Organizations have disjoint sets of secondary authenticators. The developer **DOES** care about the actual method. The end-user **MUST** have the allowed MFA method done in order to switch to the Organization.
977
+
- If the switching involves additional authentication, it has to be done through the authentication endpoint.
978
+
- To indicate an existing Session, we can follow how we implemented reauthentication. We provide `id_token_hint` which embeds `sid` (Session ID).
979
+
- The developer has no idea whether the switching can result in additional authentication. Therefore, the developer expects a single entrypoint. It implies Organization switching always begins in the authentication endpoint. If no authentication is needed, the authentication endpoint can issue authorization code and redirect immediately.
980
+
- Since it always begins with the authentication endpoint and ends with an authorization code, the frontend can treat it like an ordinary authentication.
981
+
- Like reauthentication, no new Session is created. Instead, refresh token and access token are issued like they always do.
982
+
983
+
The following table summarizes the behavior in the authentication endpoint.
| Login with a specific email | Specify the email address (not implemented yet) |||`prompt=login`||
989
+
| Signup / Login with developer-provided Organization Slug ||||`prompt=login`|`x_org_slug=SLUG`|
990
+
| Reauthenticate || Must specify |`max_age=0`|`max_age=0` implies `prompt=login`||
991
+
| Organization switching with least user interaction || Must specify |||`x_org_slug=SLUG`|
992
+
| (Subject to discussion) Organization switching with reauthentication || Must specify |`max_age=0`|`max_age=0` implies `prompt=login`|`x_org_slug=SLUG`|
993
+
994
+
### Use case 12.2: Organization Switching in SAML
995
+
996
+
In SAML, only a SAML assertion is returned to the SP.
997
+
The bearer of the SAML assertion **CANNOT** access Use case 8.2.
998
+
999
+
Therefore, Organization Switching is **IMPOSSIBLE** in SAML.
1000
+
1001
+
### Use case 12: Design Decision
1002
+
1003
+
I think this is an advanced use case that is optional in the MVP.
0 commit comments