2012年4月19日 星期四

HTTP API Authententication Set Up in JBoss

IDE: NetBean
Say set authen for accessing servlets under the path /authen/

Configure web.xml
1. edit configuration file "web.xml" in .war

2. go to 'Security' Tag
3. set Login Configuration as Basic and set Realm Name="JBossWS"
4. create a new Security Roles, say Role Name = 'someApp'
5. add a new Security Constraints:
    URL Pattern = /authen/*
    check "Enable Authentication Constraint" and select Role Name as 'someApp'

Configure jbossws-roles.properties and jbossws-users.properties in \server\default\conf\props
1. In jbossws-roles.properties, create a username and assign it the role 'someApp'. e.g.
    somebody=someApp
2. In jbossws-users.properties, add login credential for the newly created username. e.g.
    somebody=aPassword
Done.

Troubleshoot:

If not working and keep prompting 443 error or get the error:
Failed to load users/passwords/role files
IOException: No properties file: users.properties .....
Add the following line in war project jboss-web.xml
<security-domain>java:/jaas/JBossWS</security-domain>


If not working and get the error:
   org.jnp.interfaces.NamingContext cannot be cast to org.jboss.security.SubjectSecurityManager

Comment out the following line in jboss-web.xml
<security-domain flushOnSessionInvalidation="false"/>



沒有留言:

張貼留言