jakartaee / jakartaee/platform

Specify behaviour for Principal when nobody is logged in, CDI EE

Open
#841 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
No language data
Stars
230
Forks
77
Avg merge
8d 5h
Merged PRs (30d)
1

Description

**Is your feature request related to a problem? Please describe.**
From https://github.com/jakartaee/cdi/issues/769,

[@benjamin-confino](https://github.com/benjamin-confino) I recently had a customer ask why we have CDI inject a Principal containing saying unauthenticated when `HttpServletRequest.getUserPrincipal()` will give a `null` in that context.

I think that unauthenticated is the correct choice for CDI, since we cannot inject a null and hope for it to remain up to date as the context changes, but I think it would be useful to clarify the spec on this point as the current behaviour is undefined.

**Describe the solution you'd like**
We need to clarify the behavior. From [CDI-769](https://github.com/jakartaee/cdi/issues/769), comment from [@Ladicek](https://github.com/Ladicek):
What seems a bit weird to me is that the specification doesn't define the scope of the Principal bean. I guess it should be @RequestScoped, and that itself actually precludes a null value.

Contributor guide

Open the contributing guide

Research direction

Start by reading the linked CDI-769 discussion and the current CDI specification text governing the injected Principal. Clarify the bean scope and the value when nobody is authenticated; done means the specification explicitly defines this behavior and resolves the null-versus-unauthenticated question.

Written by the indexing model from the issue text.

Assessment

Domain
authentication, documentation
Issue type
Documentation
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.