mongodb - how to do authenticate in REST web service using jersey and java -


how authentication in rest web service using jersey framework , java? used netbean ide , create rest web service, application server glassfish. don't use javadb or derby. database mongodb. have google , found http://weblogs.java.net/blog/mhadley/archive/2008/03/authentication.html. site described used derby database. how should configure in web.xml authenticate?

you can use file realm of glassfish test if code & basic authentication works. add users file realm , modify configuration in web.xml:

<login-config>     <auth-method>basic</auth-method>     <realm-name>file</realm-name> </login-config> <security-role>     <description/>     <role-name>users</role-name> </security-role> 

later can switch jdbc realm , add jdbc data source use mongodb , realm.


Comments