8000 Auth: inject user in context on successful auth by System-Glitch · Pull Request #261 · go-goyave/goyave · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Auth: inject user in context on successful auth #261

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

Merged
merged 2 commits into from
Apr 14, 2025

Conversation

System-Glitch
Copy link
Member

References

Issue(s): closes #251

Description

  • On successful auth by the auth.Middleware, inject the user in the request's context.Context.
  • The user can be retrieved from the context using auth.UserFromContext[T](ctx).
  • Developers can manually inject a user in a context using auth.ContextWithUser if they want to.
user := UserFromContext[dto.InternalUser](ctx)

Possible drawbacks

None.

@System-Glitch System-Glitch added the enhancement Enhancement of existing feature label Apr 11, 2025
@System-Glitch System-Glitch added this to the v5.6.0 milestone Apr 11, 2025
@System-Glitch System-Glitch self-assigned this Apr 11, 2025
@coveralls
Copy link

Pull Request Test Coverage Report for Build 14404642902

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 9 of 9 (100.0%) changed or added relevant lines in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.003%) to 97.519%

Totals Coverage Status
Change from base Build 14357623672: 0.003%
Covered Lines: 6486
Relevant Lines: 6651

💛 - Coveralls

@System-Glitch System-Glitch merged commit e51fdb1 into master Apr 14, 2025
10 checks passed
@System-Glitch System-Glitch deleted the feat/user-context branch April 14, 2025 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Enhancement of existing feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Auth: store user in the context
2 participants
0