PolarisPrincipal missing user-defined attributes supplied during principal creation
- Dominant language
- Java
- Stars
- 2.1k
- Forks
- 522
- Avg merge
- 1d 22h
- Merged PRs (30d)
- 137
Description
### Describe the bug
When an API request is authenticated using a user principal, the internally constructed PolarisPrincipal object contains only internal attributes (such as client_id) and does not include the user-defined attributes that were supplied during principal creation.
### To Reproduce
1. Create a principal using the API:
POST /api/management/v1/principals
Include user-defined attributes, for example:
region=northamerica
department=finance
2. Use the returned client-id and client-secret to obtain an OAuth token:
POST /api/catalog/v1/oauth/tokens
3. Use the generated OAuth token to invoke an authenticated API (for example):
GET /api/management/v1/catalogs
4. Inspect the server-side PolarisPrincipal object created during request processing.
### Actual Behavior
The PolarisPrincipal object contains only internal attributes (for example, client_id) and does not include user-defined attributes that were supplied during principal creation.
### Expected Behavior
The PolarisPrincipal object should include both:
* Internal attributes (such as client_id), and
* User-defined attributes supplied during principal creation.
### Additional context
Based on initial debugging, it appears that when PolarisPrincipal is created from PrincipalEntity, the implementation uses:
principalEntity.getInternalPropertiesAsMap()
This retains internal attributes but excludes user-defined properties.
Using:
principalEntity.getPropertiesAsMap() along with principalEntity.getInternalPropertiesAsMap() will preserve both internal and user-defined attributes.
### System information
_No response_
Contributor guide
Research direction
Locate where PolarisPrincipal is created from PrincipalEntity and inspect the attribute maps used there. Verify the behavior with a focused test or existing authentication flow, and consider the issue done when the resulting principal retains both internal and user-defined attributes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- authentication
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100