|
From: AlainRemund <re...@st...> - 2007-10-09 11:37:29
|
Hello everybody
I have Jetty 6.1.1 and use Basic Authentication with the
"org.mortbay.jetty.security.JDBCUserRealm". I start Jetty in embedded mode
(I posted the important lines at the end) and connect to the database with
the "org.postgresql.Driver". So far everything works perfect (when I try to
connect to the Server I have to authenticate and it correctly checks if this
user exists and if the password is valid).
In the WebServlet itself I would like to get the username with the method
"request.getRemoteUser()". But that doesn't work! The method
"request.getRemoteUser()" returns null. I also tried the methods
"request.isUserInRole(String)" and "request.getUserPrincipal()" and neither
of them works.
I was very astonished when I realized, that the method
"request.getAuthType()" correctly returns "BASIC".
Am I missing something? Would be nice to get an answer.
Greez,
Alain
Constraint constraint = new Constraint();
constraint.setName(Constraint.__BASIC_AUTH);;
constraint.setRoles(new String[]{"user","admin","moderator"});
constraint.setAuthenticate(true);
SecurityHandler sh = new SecurityHandler();
sh.setUserRealm(new JDBCUserRealm("Sisyphus", "file:///" +
System.getProperty("user.dir") + "/webroot/jdbcRealm.properties"));
--
View this message in context: http://www.nabble.com/Problems-getting-autheticated-user-name-with-JDBCUserRealm-tf4593639.html#a13113842
Sent from the Jetty Support mailing list archive at Nabble.com.
|