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: make auth flows stateless [WPB-16058] #3871

Merged
merged 3 commits into from
Feb 11, 2025

Conversation

saleniuk
Copy link
Contributor

@saleniuk saleniuk commented Feb 11, 2025

TaskWPB-16058 [Android] Create login flow selector


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?

Currently, when the app needs to change the server config to a custom one, it keeps it in a global app state AuthServerConfigProvider that's stored as long as the app is running. It creates some issues after logging in on custom backend, the config to be used next as a default one will be the last one that was used, not the default one for the build, but if the user closes the app and opens again then it resets so it's confusing. It's even more complicated in case of SSO login as the server config can be changed to a different one during the single login flow and it can affect the whole app.

This PR is to make auth flows stateless. When the app wants to start the login flow for any custom config, then it's passed as a navigation parameter and used only during this particular login flow, so when the user closes it or changes to another one then it just opens again with a different one and there are no issues with changing current config or persisting it for the whole app and keeping it synced. The only place where it wasn't so streamlined was SSO login - when user logs in via SSO with a custom config in a browser, then the app doesn't get the SSO result deeplink with custom backend data, so it needs to be kept and passed from one step to another, but in that case it's stored in savedStateHandle of a login flow parent and thanks to that it still keeps the stateless properties from a login flow perspective - when the flow is finished/canceled then this custom config is just dropped and doesn't affect any other started login flow.

TLDR: AuthServerConfigProvider is removed and custom config is being passed as a navigation parameter.

Testing

Test Coverage (Optional)

  • I have added automated test to this contribution

How to Test

Log in using custom config.


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.

…flow' into feat/stateless-auth-flows

# Conflicts:
#	app/src/main/kotlin/com/wire/android/navigation/MainNavHost.kt
@saleniuk saleniuk changed the title Feat/stateless auth flows feat: make auth flows stateless [WPB-16058] Feb 11, 2025
@saleniuk saleniuk requested a review from yamilmedina February 11, 2025 12:32
@saleniuk saleniuk merged commit d2ad895 into epic/new-sso-login-flow Feb 11, 2025
7 of 10 checks passed
@saleniuk saleniuk deleted the feat/stateless-auth-flows branch February 11, 2025 14:23
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.

3 participants