undertow/src/main/java/org/wildfly/extension/undertow/security/jaspi/JASPICSecurityContext.java
@Override
    public Account getAuthenticatedAccount() {
        Account account = super.getAuthenticatedAccount();
        if (account == null)
            account = this.cachedAuthenticatedAccount;
        return account;
    }
@Override
    public Account getAuthenticatedAccount() {
        Account account = super.getAuthenticatedAccount();
        if (account == null)
            account = this.cachedAuthenticatedAccount;
        return account;
    }
<p>
Overrides the parent method to return the cached authenticated account (that is, the account that was set in the
session as a result of a SAM setting the {@code javax.servlet.http.registerSession} property) when the regular
account is null. This allows a SAM to retrieve the cached account principal by calling {@code getUserPrincipal()}
on {@code HttpServletRequest}.
</p>

@return the authenticated account (or cached account when it is null).