Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Principal is not replicated #54

Open
jzwadowski opened this issue Dec 20, 2018 · 0 comments
Open

Principal is not replicated #54

jzwadowski opened this issue Dec 20, 2018 · 0 comments

Comments

@jzwadowski
Copy link

Tomcat store Principal in the session object. Although it is said in StandardSession:

/**
* The authenticated Principal associated with this session, if any.
* IMPLEMENTATION NOTE: This object is not saved and
* restored across session serializations!
*/
protected transient Principal principal = null;

but Request method getUserPrincipal or getRemoteUser takes principal from field which is set inside AuthenticatorBase.

        Principal principal = request.getUserPrincipal();
        if (principal == null) {
            Session session = request.getSessionInternal(false);
            if (session != null) {
                principal = session.getPrincipal();
                if (principal != null) {
                    if (log.isDebugEnabled()) {
                        log.debug("We have cached auth type " + session.getAuthType() +
                                " for principal " + principal);
                    }
                    request.setAuthType(session.getAuthType());
                    request.setUserPrincipal(principal);
                }
            }
        }

I suggest that userPrincipal and authType should be replicated

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants