Authentication and Authorization in servlets

不问归期 提交于 2019-12-24 06:48:41

问题


I am using jboss server. I want to do BASIC authentication using web.xml file. How do I do that?


回答1:


The tutorial on How to Configure JBoss for Basic Authentication should help you in this




回答2:


The steps are

  1. Add security-constraint in web.xml for secure pages
  2. Apply login-config in web.xml
  3. In jboss-web.xml apply security-domain
  4. Create properties files for user and roles

The following link explains this pretty well with an example https://community.jboss.org/wiki/BASICAuthentication

users.properties file uses a format:

username1=password1
username2=password2

roles.properties file uses a format:

username1=role1,role2,...
username1.RoleGroup1=role3,role4,...
username2=role1,role3,...

This link gives more details about the user and role properties file. https://community.jboss.org/wiki/UsersRolesLoginModule



来源:https://stackoverflow.com/questions/10612231/authentication-and-authorization-in-servlets

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!