Skip to content

Commit

Permalink
Don't overwrite valid Principal from password callback will null
Browse files Browse the repository at this point in the history
  • Loading branch information
markt-asf committed Sep 19, 2024
1 parent 50dddaa commit db91aa4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ public void handle(Callback[] callbacks) throws IOException, UnsupportedCallback
if (callback instanceof CallerPrincipalCallback) {
CallerPrincipalCallback cpc = (CallerPrincipalCallback) callback;
name = cpc.getName();
principal = cpc.getPrincipal();
if (cpc.getPrincipal() != null) {
principal = cpc.getPrincipal();
}
subject = cpc.getSubject();
} else if (callback instanceof GroupPrincipalCallback) {
GroupPrincipalCallback gpc = (GroupPrincipalCallback) callback;
Expand Down
6 changes: 6 additions & 0 deletions webapps/docs/changelog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,12 @@
associated with persisting the Jakarta Authentication provider
configuration. (markt)
</fix>
<fix>
When processing Jakarta Authentication callbacks, don't overwrite a
Principal obtained from the <code>PasswordValidationCallback</code> with
<code>null</code> if the <code>CallerPrincipalCallback</code> does not
provide a Principal. (markt)
</fix>
</changelog>
</subsection>
</section>
Expand Down

0 comments on commit db91aa4

Please sign in to comment.