I've created a play-java web application, with the default Application controller:
package controllers; import play.*; import play.mvc.*; public class Application extends Controller { public Result index() { String loggedUser = ""; // Would like to get the request logged in user somehow... return ok(loggedUser + ", Hi there!"); } } What i need is to retrieve the user name which is logged in :
I'm visiting "http://localhost:9000" by chrome browser, and i need to retrieve the windows logged-in user which browses my play application, in order to check its premissions with our DB users tables.
In Servlet API - i think it was possible by using:
String name = request.getUserPrincipal().getName(); // Or String name = request.getRemoteUser(); In ASP. MVC WebApi Controller- the correspond code is:
HttpContext.Current.User.Identity.Name How can i implement it in play-framework simple java application?
====================
UPDATE:
i believe i need to implmenet windows authentication (NTLM) in play java application in order to get the windows username who browses my play application remotely. can someone please assist me with this?