On 09/01/13 06:12, shruthi ganesh wrote:
I am writing a plugin to authorize an authenticated user in
jenkins. I require the username of the currently logged in user. I have
used mysql db for authentication. Is there any possibility of getting
the username?. Does jenkins store the user details of the logged in user
anywhere?.
This is probably a question better suited to the jenkinsci-dev mailing list.
I've used code like this to get the current user's ID:
import hudson.model.User;
import org.acegisecurity.context.SecurityContextHolder;
String userId =
SecurityContextHolder.getContext().getAuthentication().getName();
User u = User.get(userId, false);
Regards,
Chris