Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(new-login): Enterprise SSO Login UX Flows (WPB-14364) #3904

Open
wants to merge 58 commits into
base: develop
Choose a base branch
from

Conversation

saleniuk
Copy link
Contributor

@saleniuk saleniuk commented Mar 6, 2025

EpicWPB-14364 [Android] Implement Enterprise SSO Login UX Flows


PR Submission Checklist for internal contributors

  • The PR Title

    • conforms to the style of semantic commits messages¹ supported in Wire's Github Workflow²
    • contains a reference JIRA issue number like SQPIT-764
    • answers the question: If merged, this PR will: ... ³
  • The PR Description

    • is free of optional paragraphs and you have filled the relevant parts to the best of your ability

What's new in this PR?

This PR combines all PRs created and merged to this epic branch related to the new enterprise login flow:

Solutions

All can be seen retroactively on each small PR.

Dependencies (Optional)

It uses changes from the corresponding kalium branch and PR wireapp/kalium#3309.

Needs releases with:

Testing

Test Coverage (Optional)

  • I have added automated test to this contribution

How to Test

Open dev build to have new flow by default (it uses anta backend) or use custom backend deeplink to switch to new one by adding login-type=new.


PR Post Submission Checklist for internal contributors (Optional)

  • Wire's Github Workflow has automatically linked the PR to a JIRA issue

PR Post Merge Checklist for internal contributors

  • If any soft of configuration variable was introduced by this PR, it has been added to the relevant documents and the CI jobs have been updated.

References
  1. https://sparkbox.com/foundry/semantic_commit_messages
  2. https://github.com/wireapp/.github#usage
  3. E.g. feat(conversation-list): Sort conversations by most emojis in the title #SQPIT-764.

saleniuk and others added 20 commits January 23, 2025 15:44
…new-sso-login-flow

# Conflicts:
#	app/src/main/kotlin/com/wire/android/WireApplication.kt
#	app/src/main/kotlin/com/wire/android/ui/home/messagecomposer/MessageComposerInput.kt
#	app/src/main/kotlin/com/wire/android/util/lifecycle/ConnectionPolicyManager.kt
#	app/src/test/kotlin/com/wire/android/util/lifecycle/SyncLifecycleManagerTest.kt
#	default.json
#	kalium
Copy link

Ups 🫰🟨

This PR is too big. Please try to break it up into smaller PRs.

@AndroidBob
Copy link
Collaborator

AndroidBob commented Mar 6, 2025

New ADR(s) in this PR 📚:

5. Simplified enterprise login

Date: 2025-01-23

Status

Accepted

Context

Starting (potentially) from Android 4.12.x the app will support the new enterprise login flows, this means in practice that the app needs to support both flows current/old.

The current flow (old)

Customers configure their setup manually in their backend.
The user experience for this makes the user selects manually which flow they must use by going to the correct screens, i.e. going to the tab and select login with SSO code, or login with email, or use a deeplink to load the on premise configuration, and then select the correct flow.

The new flow

Customers, via team settings and Back-office tools, will be able to load this config to facilitate the decision of which flow the user must use. This will make the app, in conjunction with the backend, decide for the user which path/flow they must use to login by just having one input field, “email or SSO code”.
The adoption won’t be automatically via deprecation, hence the need to support both flows for some time. To clarify a bit how this looks in practice for the code we have, how this will be implemented, a high level look of the two flows living together, the following diagram can be used.

Decision

We will keep both flows, the current as-is and the new one, being the app able to decide which one to use based on the configuration received from the backend.

%%{
  init: {
    'theme': 'neutral'
  }
}%%

flowchart LR
    z((App loads</br> BE/API context)) --> di
    di{BE supports </br>API >= 8 ?}:::someclass -- Yes --> a1
    di -- No</br>OR Authenticated Proxy --> b1
    classDef someclass fill:#f96
    subgraph new_flow
      a0@{ shape: braces, label: "These flows are selected by the app and the BE" }
      a1[StartLoginScreen </br>'Enter email or SSO code'] -- looks like SSO code --> a2[Go to SSO flow path 6-7] 
      a1 -- Looks like an email? --> a3[BE replies which path to go 1-4]
    end
    subgraph current_flow
      b0@{ shape: braces, label: "These flows are selected manually by the user" }
      b1[WelcomeScreen] --> b2[LoginEmailScreen]
      b1 --> b3[LoginWithSSOCodeScreen]
    end
Loading

Consequences

  • The code base will have some duplication for some time, but this will be removed when the old flow is deprecated.
  • To select the correct flow, the app will need to load the BE context, based on the API version, and then decide which flow to use.
  • The navigation, entry point will need to be dynamic, based on the flow selected.

@codecov-commenter
Copy link

codecov-commenter commented Mar 6, 2025

Codecov Report

Attention: Patch coverage is 58.53659% with 187 lines in your changes missing coverage. Please review.

Project coverage is 45.75%. Comparing base (e338311) to head (bdfb48e).

Files with missing lines Patch % Lines
...entication/login/sso/LoginSSOViewModelExtension.kt 0.00% 40 Missing ⚠️
...id/ui/newauthentication/login/NewLoginViewModel.kt 75.47% 18 Missing and 21 partials ⚠️
...d/ui/authentication/login/sso/LoginSSOViewModel.kt 54.71% 20 Missing and 4 partials ⚠️
.../ui/newauthentication/login/NewLoginDestination.kt 0.00% 16 Missing and 1 partial ⚠️
...id/ui/newauthentication/login/NewLoginFlowState.kt 60.86% 8 Missing and 1 partial ⚠️
...otlin/com/wire/android/ui/WireActivityViewModel.kt 68.18% 3 Missing and 4 partials ⚠️
.../ui/authentication/login/sso/SSOUrlConfigHolder.kt 12.50% 7 Missing ⚠️
...n/com/wire/android/feature/AccountSwitchUseCase.kt 40.00% 5 Missing and 1 partial ⚠️
...ndroid/ui/authentication/login/LoginErrorDialog.kt 0.00% 5 Missing ⚠️
...tlin/com/wire/android/util/CurrentScreenManager.kt 0.00% 5 Missing ⚠️
... and 14 more
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #3904      +/-   ##
===========================================
+ Coverage    45.56%   45.75%   +0.18%     
===========================================
  Files          491      504      +13     
  Lines        17064    17345     +281     
  Branches      2846     2913      +67     
===========================================
+ Hits          7776     7936     +160     
- Misses        8495     8600     +105     
- Partials       793      809      +16     
Files with missing lines Coverage Δ
...lin/com/wire/android/config/DefaultServerConfig.kt 100.00% <100.00%> (ø)
...rc/main/kotlin/com/wire/android/ui/WireActivity.kt 0.00% <ø> (ø)
...ion/create/overview/CreateAccountOverviewParams.kt 0.00% <ø> (ø)
...droid/ui/newauthentication/login/NewLoginAction.kt 100.00% <100.00%> (ø)
.../ui/newauthentication/login/NewLoginScreenState.kt 100.00% <100.00%> (ø)
...hentication/login/ValidateEmailOrSSOCodeUseCase.kt 100.00% <100.00%> (ø)
...tication/create/code/CreateAccountCodeViewModel.kt 0.00% <0.00%> (ø)
...on/create/details/CreateAccountDetailsViewModel.kt 0.00% <0.00%> (ø)
...ui/authentication/login/LoginViewModelExtension.kt 92.30% <92.30%> (ø)
.../authentication/login/email/LoginEmailViewModel.kt 75.55% <75.00%> (-0.57%) ⬇️
... and 20 more

Continue to review full report in Codecov by Sentry.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e338311...bdfb48e. Read the comment docs.

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

github-actions bot commented Mar 6, 2025

Built wire-android-staging-compat-pr-3904.apk is available for download

Copy link
Contributor

github-actions bot commented Mar 6, 2025

Built wire-android-dev-debug-pr-3904.apk is available for download

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants