jakartaee / jakartaee/authorization

Convenience method for getting Subject

Open
#130 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
17
Forks
20
PR merge metrics
No merged PRs in 30d

Description

The Subject (representing the authenticated identity) is currently obtained in Jakarta Authorization in the following way:

```java
Subject subject;
try {
subject = (Subject) PolicyContext.getContext("javax.security.auth.Subject.container");
} catch (PolicyContextException ex) {
throw new RuntimeException(ex);
}
```

We could for convenience and for ease of readability in the using code add a `getSubject()` method to `PolicyContext`

Contributor guide

Open the contributing guide

Research direction

Start by reading the PolicyContext class and its existing getContext(String) API, then trace how the authenticated Subject is obtained in the reported Jakarta Authorization usage. Done means PolicyContext exposes getSubject() so callers can obtain the authenticated Subject without the shown lookup and exception-handling boilerplate.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
authorization
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.