[Bug]: User is not added to the running thread when authenticating API Tokens at portal and host levels
Maintainers usually reply within 3 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 55/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Domain
- api, authentication, backend
Research direction
Start by tracing API token authentication and the GetCurrentUser call that initializes the request's user identity. Focus on the portal- and host-level token paths, and identify where the token creator's user should be applied so downstream code can access that identity. Verify that user-level tokens still behave as before and add or run the relevant authentication tests; the issue names no specific test files.
Written by the indexing model from the issue text.
Description
Is there an existing issue for this?
- I have searched the existing issues
What happened?
When securing endpoints with ApiTokens we can specify whether these tokens should operate at user, portal or host level. And the token being used is tied to this scope (and subsequently also to specific APIs). For a token at User level, we add that user to the thread and in subsequent calls to GetCurrentUser you will see this user. But for tokens at Portal and Host levels we do not add the user (that created the token). This has several disadvantages:
- In code that is being called we now cannot check the user's identity any longer
- For traceability in this downstream code it's useful to also know who owns the token
All tokens are created by a user (could be an admin or host user). Although the token could be implemented in a m2m situation, I believe we should still impersonate the creating user on the api endpoint.
Steps to reproduce?
- Create host token
- Use in a method that is protected by Host level Api Token
- Step through code and notice how UserInfo is the default inititialized (anonymous) user
Current Behavior
No response
Expected Behavior
No response
Relevant log output
Anything else?
No response
Affected Versions
10.4.1 (latest release)
What browsers are you seeing the problem on?
No response
Code of Conduct
- I agree to follow this project's Code of Conduct
- Dominant language
- C#
- Stars
- 1.1k
- Forks
- 791
- Avg merge
- 4d 5h
- Merged PRs (30d)
- 27
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from dnnsoftware/Dnn.Platform
-
Status: New
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
dnnsoftware/Dnn.Platform#6681 ·
Maintainers usually reply within 3 days
-
Status: New
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
dnnsoftware/Dnn.Platform#6051 · 4 comments ·
Maintainers usually reply within 3 days
-
Status: New
Difficulty 4/5 3-5 days Newbie friendliness 54/100
dnnsoftware/Dnn.Platform#7604 ·
Maintainers usually reply within 3 days
-
Status: New
Difficulty 4/5 3-5 days Newbie friendliness 48/100
dnnsoftware/Dnn.Platform#7603 ·
Maintainers usually reply within 3 days
-
Status: New
Difficulty 4/5 3-5 days Newbie friendliness 38/100
dnnsoftware/Dnn.Platform#7599 ·
Maintainers usually reply within 3 days
All issues in dnnsoftware/Dnn.Platform
Similar issues
-
Difficulty 1/5 Under an hour Newbie friendliness 80/100
Unity-Technologies/unity-agent-plugin#118 ·
Maintainers usually reply within 1 day
-
The Recommended preset turns on Import Uno DSP, which only works with the Material themePossibly taken @agneszitte claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 92/100
unoplatform/uno.templates#2388 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
eyalgolan/statecraft-israel#2732 ·
Maintainers usually reply within 1 day
-
要トリアージ
Difficulty 2/5 1-3 hours Newbie friendliness 64/100
Maintainers usually reply within 1 day
-
kind/chore status/draft
Difficulty 2/5 1-3 hours Newbie friendliness 65/100
Altinn/altinn-events#1158 ·
Maintainers usually reply within 1 day