问题
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
- Add security-constraint in web.xml for secure pages
- Apply login-config in web.xml
- In jboss-web.xml apply security-domain
- 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