Doc Feedback: Misuse of Authorization Header in Custom Authentication Handler Example
Nobody has claimed this yet.
- Dominant language
- CSS
- Stars
- 99
- Forks
- 708
- Avg merge
- 1d 7h
- Merged PRs (30d)
- 22
Description
Summary
The current documentation example for a custom API authentication handler uses the HTTP Authorization header to pass a plain username (e.g., Authorization: userName:xxx). This is not a valid or real-world authentication pattern and may mislead users into implementing insecure or non-standard solutions.
Problem Description
The documented example validates requests using logic similar to: Authorization: userName:janaka
This approach has several issues:
❌ Violates HTTP and OAuth2 standards
❌ Misuses the Authorization header, which is reserved for authentication schemes such as Bearer, Basic, etc.
❌ Can confuse users about recommended APIM security practices
In real-world systems, usernames are never sent in plain text via the Authorization header.
Why This Is an Issue
Developers may assume this is an acceptable production pattern
Encourages insecure implementations
Reduces documentation credibility
Proposed Improvement (Recommended)
If the intention of the example is to demonstrate custom request validation logic, the example should:
✅ Use a custom HTTP header instead of Authorization
Example:
X-User-Name: janaka
This:
- Keeps Authorization semantics intact
- Clearly signals that this is not authentication
- Aligns with common industry practices
- Avoids security misconceptions
Suggested Documentation Changes
- Update Code Example
private String getUserNameHeader(Map headers) {
return (String) headers.get("X-User-Name");
}
if (userName != null && !userName.isEmpty()) {
return true;
}
- Update Sample curl Command
curl -X GET http://localhost:8280/sample/1.0.0/test \
-H "X-User-Name: janaka"
- Add a Clear Note in Documentation
Note: This example is for demonstrating custom handler mechanics only.
It is not a replacement for OAuth2/JWT-based authentication, which is the recommended approach for production APIs.
Requested Action
Update the example to use a custom header
Add a clarification note about real-world authentication
Avoid using the Authorization header for non-standard purposes
Contributor guide
No contributing guide indexed for this repository
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.
Research direction
Open the linked custom authentication handler documentation page and locate the Java example and sample curl command that use the Authorization header. Update the example to use X-User-Name, add the requested production-authentication clarification, and verify the page no longer presents the plain username header as an authentication pattern.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, authentication, documentation, security
- Issue type
- Documentation
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 58/100