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

NAS-132648 / 25.04 / query param handling for auth tokens #11080

Open
wants to merge 5 commits into
base: master
Choose a base branch
from

Conversation

aervin
Copy link
Collaborator

@aervin aervin commented Nov 20, 2024

Changes:

Testing:
One method:

  • clear localStorage
  • you'll have to comment out the https: check in AuthService.setQueryToken
  • midclt call auth.generate_token
  • append the token to an app route: localhost:4200/storage/disks?token=<token>

Downstream

Affects Reasoning
Documentation

…e. forward query params on redirect in auth-guard.service
@bugclerk bugclerk changed the title NAS-132648: query param handling for auth tokens NAS-132648 / 25.04 / query param handling for auth tokens Nov 20, 2024
@bugclerk
Copy link
Contributor

@aervin
Copy link
Collaborator Author

aervin commented Nov 20, 2024

The approach so far is to forward query params on redirect to /signin (AuthGuardService:canActivate). From there, add a bit of logic to signin.store and auth.service to handle the token.

However, this isn't working like I'd expect. Seems that WebsocketHandlerService is calling its resetUI method and interfering with the redirect.

image

Copy link

codecov bot commented Nov 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 82.33%. Comparing base (cf486c8) to head (911e1d4).
Report is 19 commits behind head on master.

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #11080      +/-   ##
==========================================
- Coverage   82.35%   82.33%   -0.02%     
==========================================
  Files        1630     1644      +14     
  Lines       57229    57522     +293     
  Branches     5915     5933      +18     
==========================================
+ Hits        47130    47362     +232     
- Misses      10099    10160      +61     

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

Copy link
Collaborator

@undsoft undsoft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems to be redirecting fine for me:

2024-11-21.11.03.57.mov

src/app/services/auth/auth.service.ts Outdated Show resolved Hide resolved
@undsoft
Copy link
Collaborator

undsoft commented Nov 21, 2024

BTW, I don't know if tokens in browser history is kosher.

…t connection to the NAS has opened at least once. adds queryToken to signin.store state.
@aervin aervin marked this pull request as ready for review November 25, 2024 14:53
@aervin aervin requested a review from a team as a code owner November 25, 2024 14:53
@aervin aervin requested review from RehanY147 and undsoft and removed request for a team November 25, 2024 14:53
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.

3 participants