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

[AC-3043] Refactor AuthService to only use organization api key login #622

Conversation

eliykat
Copy link
Member

@eliykat eliykat commented Sep 18, 2024

🎟️ Tracking

https://bitwarden.atlassian.net/browse/AC-3043

📔 Objective

AuthService supports multiple login methods via LogInStrategys, including password, SSO, personal api key, etc. This is from old jslib code which was used by multiple clients.

This PR:

  1. deletes unused LoginStrategies
  2. combines the OrganizationLoginStrategy into the LoginStrategy base class
  3. refactors LoginStrategy to remove unused code
  4. then combines the LoginStrategy class into AuthService - resulting in a single login method that just does the work itself
  5. deletes unused services

The refactoring steps are easier to follow if you review commit-by-commit.

Depends on #621 being merged first.

📸 Screenshots

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

@eliykat eliykat requested a review from a team as a code owner September 18, 2024 04:14
@eliykat eliykat requested a review from r-tome September 18, 2024 04:14
Copy link

codecov bot commented Sep 18, 2024

Codecov Report

Attention: Patch coverage is 68.57143% with 11 lines in your changes missing coverage. Please review.

Project coverage is 2.48%. Comparing base (9dc497d) to head (51f80c9).
Report is 1 commits behind head on main.

✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
src/services/auth.service.ts 88.46% 3 Missing ⚠️
src/app/accounts/apiKey.component.ts 0.00% 2 Missing ⚠️
src/commands/logout.command.ts 0.00% 2 Missing ⚠️
src/abstractions/auth.service.ts 0.00% 1 Missing ⚠️
src/app/app.component.ts 0.00% 1 Missing ⚠️
src/app/services/services.module.ts 0.00% 1 Missing ⚠️
src/program.ts 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff            @@
##            main    #622      +/-   ##
========================================
+ Coverage   1.20%   2.48%   +1.28%     
========================================
  Files         59      59              
  Lines       2572    2573       +1     
  Branches     466     467       +1     
========================================
+ Hits          31      64      +33     
+ Misses      2541    2509      -32     

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

Copy link
Contributor

github-actions bot commented Sep 18, 2024

Logo
Checkmarx One – Scan Summary & Details618983d6-efe0-4128-94ce-32cc01ef9fc3

Fixed Issues

Severity Issue Source File / Package
LOW Use_Of_Hardcoded_Password /jslib/common/spec/misc/logInStrategies/logIn.strategy.spec.ts: 27
LOW Use_Of_Hardcoded_Password /jslib/common/spec/misc/logInStrategies/passwordLogIn.strategy.spec.ts: 24
LOW Use_Of_Hardcoded_Password /jslib/common/spec/misc/logInStrategies/passwordLogIn.strategy.spec.ts: 24
LOW Use_Of_Hardcoded_Password /jslib/common/spec/misc/logInStrategies/passwordLogIn.strategy.spec.ts: 23
LOW Use_Of_Hardcoded_Password /jslib/common/spec/misc/logInStrategies/passwordLogIn.strategy.spec.ts: 23
LOW Use_Of_Hardcoded_Password /jslib/common/spec/misc/logInStrategies/passwordLogIn.strategy.spec.ts: 22
LOW Use_Of_Hardcoded_Password /jslib/common/spec/misc/logInStrategies/passwordLogIn.strategy.spec.ts: 22
LOW Use_Of_Hardcoded_Password /jslib/common/spec/misc/logInStrategies/passwordLogIn.strategy.spec.ts: 22
LOW Use_Of_Hardcoded_Password /jslib/common/spec/misc/logInStrategies/logIn.strategy.spec.ts: 27
LOW Use_Of_Hardcoded_Password /jslib/common/spec/misc/logInStrategies/passwordLogIn.strategy.spec.ts: 24
LOW Use_Of_Hardcoded_Password /jslib/common/spec/misc/logInStrategies/passwordLogIn.strategy.spec.ts: 24
LOW Use_Of_Hardcoded_Password /jslib/common/spec/misc/logInStrategies/passwordLogIn.strategy.spec.ts: 23
LOW Use_Of_Hardcoded_Password /jslib/common/spec/misc/logInStrategies/passwordLogIn.strategy.spec.ts: 23
LOW Use_Of_Hardcoded_Password /jslib/common/spec/misc/logInStrategies/passwordLogIn.strategy.spec.ts: 22
LOW Use_Of_Hardcoded_Password /jslib/common/spec/misc/logInStrategies/passwordLogIn.strategy.spec.ts: 22
LOW Use_Of_Hardcoded_Password /jslib/common/spec/misc/logInStrategies/passwordLogIn.strategy.spec.ts: 22

@eliykat eliykat changed the title [AC-3034] Refactor AuthService to only use organization api key login [AC-3043] Refactor AuthService to only use organization api key login Sep 18, 2024
Base automatically changed from ac/ac-3047/refactor-logincommand-to-only-use-organization-api-key-login to main September 18, 2024 21:50
@eliykat eliykat force-pushed the ac/ac-3043/refactor-authservice-to-only-use-organization-api-key-login branch from c5c191d to 55253c4 Compare September 18, 2024 23:41
@eliykat eliykat merged commit 4652c64 into main Sep 22, 2024
20 checks passed
@eliykat eliykat deleted the ac/ac-3043/refactor-authservice-to-only-use-organization-api-key-login branch September 22, 2024 22:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants