Skip to content

Commit

Permalink
Merge pull request #281 from smillidge/fix-subject-key
Browse files Browse the repository at this point in the history
Revert Subject context key to start with javax
  • Loading branch information
arjantijms committed Aug 10, 2020
2 parents 58b002a + a7fbb94 commit 815b0fd
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@

public class JACC {

public static String SUBJECT_CONTAINER_KEY = "javax.security.auth.Subject.container";

public static Subject getSubject() {
return getFromContext("jakarta.security.auth.Subject.container");
return getFromContext(SUBJECT_CONTAINER_KEY);
}

public static boolean isCallerInRole(String role) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ public Principal getCallerPrincipalFromPrincipals(Iterable<Principal> principals
// So we're getting the principals from the Subject here. Do note that we miss the
// potential extra deployment roles here which may be in the principals collection we get
// passed in.
Subject subject = (Subject) PolicyContext.getContext("jakarta.security.auth.Subject.container");
Subject subject = (Subject) PolicyContext.getContext(JACC.SUBJECT_CONTAINER_KEY);

if (subject == null) {
return null;
Expand All @@ -179,7 +179,7 @@ public List<String> getMappedRolesFromPrincipals(Iterable<Principal> principals)
if (isLiberty || isJboss) {

try {
Subject subject = (Subject) PolicyContext.getContext("jakarta.security.auth.Subject.container");
Subject subject = (Subject) PolicyContext.getContext(JACC.SUBJECT_CONTAINER_KEY);
if (subject == null) {
return emptyList();
}
Expand Down

0 comments on commit 815b0fd

Please sign in to comment.