English 中文(简体)
• 如何利用妇女委员会和java在REEST网络服务中认证
原标题:how to do authenticate in REST web service using jersey and java

how to do authentication in REST web service using jersey framework and java? I used NetBean IDE and create Rest web service, the application server is glassfish. I don t use javadb or derby. My database is mongodb. I have google and i found http://weblogs.java.net/blog/mhadley/archive/2008/03/authentication.html. But that site described he used derby database. How should i configure in web.xml for authenticate?

最佳回答

You can as well use file realm of glassfish to test if your code & basic authentication works. For that add your users into file realm and modify your 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 you can switch to jdbc realm and add jdbc data source to use with mongodb and realm.

问题回答

页: 1 届时,您将拥有单独的分行的用户证书(在这种情况下,可以免费使用您有支架司机的分行)。

你们也可以利用另一个领域进行认证。 如果你们只有少数用户,而且不需要改变其使用名称/密码,那么你就只能使用玻璃鱼的档案。

你们也可以设计自己的领域,但这项工作更多。 你们可以找到这方面的一些博客条目,或者仅仅在玻璃鱼来源法中找到某种灵感。

我不认为你可以把参考的jdbcrealm用于mongodb,因为我认为它有完全的jdbc驱动力(因为这可能没有意义,mongodb是一个面向文件的数据库,而不是一个关系数据库)。 如果你真的需要把用户和群体定义为mongodb,那么你就应该写一个习俗领域。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签