Skip to content

Commit

Permalink
Merge pull request #25290 from OndroMih/ondromih-fix-25141-random-403
Browse files Browse the repository at this point in the history
Fix random 403 responses
  • Loading branch information
arjantijms authored Dec 31, 2024
2 parents 3252cc5 + e3c9da0 commit eda0e4d
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public class SecurityContext extends AbstractSecurityContext {
// Did the client log in as or did the server generate the context
private boolean serverGeneratedSecurityContext;

private Principal sessionPrincipal;
private final ThreadLocal<Principal> sessionPrincipal = new ThreadLocal<>();

/*
* This creates a new SecurityContext object. Note: that the docs for Subject state that the internal sets (eg. the
Expand Down Expand Up @@ -370,11 +370,15 @@ public String toString() {
}

public Principal getSessionPrincipal() {
return sessionPrincipal;
return sessionPrincipal.get();
}

public void setSessionPrincipal(Principal sessionPrincipal) {
this.sessionPrincipal = sessionPrincipal;
if (sessionPrincipal != null) {
this.sessionPrincipal.set(sessionPrincipal);
} else {
this.sessionPrincipal.remove();
}
}

public Set<Principal> getPrincipalSet() {
Expand Down

0 comments on commit eda0e4d

Please sign in to comment.