Hi dev list,

I'm implementing an action in which I want to get the logged in user.
The following code:

public void computeLoggedInUserName() {
        final Object principal = Jenkins.getAuthentication().getPrincipal();
        if (principal instanceof Details) {
            loggedInUserName = ((Details)principal).getUsername();
            return;
        }
        if (principal instanceof LdapUserDetails) {
            loggedInUserName = ((LdapUserDetails)principal).getUsername();
            return;
        }
        loggedInUserName = "anonymous";
    }

was doing the job.
Since I migrated to 1.554.X LTS version (same for latest LTS: 1.565.1),
this method always return "anonymous" even
if Jenkins.getAuthentication().isAuthenticated() return true.

Is it a regression or am I doing it the wrong way?

Thanks for your help.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to