I am building a separate admincenter tool which required admin role to access. How can I specify it in auth-constraint of web.xml.
I tried below, it is not working
<security-constraint>
<web-resource-collection>
<web-resource-name>commonlogin-secure-resources</web-resource-name>
<url-pattern>/rest/readyToLand</url-pattern>
</web-resource-collection>
<auth-constraint>
<role-name>test</role-name>
<role-name>Administrator</role-name>
</auth-constraint>
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
In server.xml
<basicRegistry>
<user name="admin" password="adminPassword"/>
</basicRegistry>
<administrator-role>
<user>admin</user>
</administrator-role>
After login if I try to access this url it is saying i do not have permission to access it. Do i need to do binding somewhere??
After adding IBM-Authorization-Roles: com.ibm.ws.management to MANIFEST.MF I am able to access it with admin role, but not with test role. What's wrong with the configuration. How can I do role mapping in osgi bundle?
In
web.xmladded extra roleallAuthenticatedUsersto allow them along with admin user. Didn't find much in ibm documentation about OSGI bundle security. But it worked.I think I don't require
<role-name>Administrator</role-name>. Butrequest.isUserInRole('Administrator')is giving true at any case.Updated Any of the case i am unable to identify both admin, test users in application with above configurations. With
IBM-Authorization-Roles: com.ibm.ws.managementonly admin can be identified -request.isUserInRole('Administrator')will work. But notrequest.isUserInRole('test')even though user logged in with that test role & able to access that URL.It is just weird - it is allowing access but when i check what is the role, it is not working. Looks like there is an issue in IBM - Liberty code (17.0.0.4). But not sure.