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

[Feature Request] AuthProvider should be lazy #1068

Open
lonix1 opened this issue Mar 9, 2019 · 1 comment
Open

[Feature Request] AuthProvider should be lazy #1068

lonix1 opened this issue Mar 9, 2019 · 1 comment

Comments

@lonix1
Copy link

lonix1 commented Mar 9, 2019

AuthProvider.getUser() is run on every request.

This is overkill:

  1. Not every request needs access to the principal in this.httpContext.user
  2. Routes that are secured by a token/JWT will undergo authentication anyway, and therefore authentication occurs twice!

Please allow lazy eval of methods on interfaces.AuthProvider.

I don't know how that would look. Maybe a lazy loading getter. Or a call to this.httpContext.loadUser() and then one can safely call this.httpContext.user.

@Blockost
Copy link

Blockost commented Jan 7, 2020

[...]
2. Routes that are secured by a token/JWT will undergo authentication anyway, and therefore authentication occurs twice!
[...]

Yes, and it is pretty annoying. Even more when the browser sends pre-flight (OPTIONS) requests every time! These requests go through AuthProvider as well

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

No branches or pull requests

2 participants