Basic authentication is sort of authentication mechanism for restricting access of resources on tomcat. This is a simple way to limiting accesses but it uses easy to sniff plain http messages with base64 encoded username and password pair inside http header.
In order to apply basic http authentication on axis2 web services, please follow the steps, below:
In order to apply basic http authentication on axis2 web services, please follow the steps, below:
- Add this config xml to tomcat-users.xml under conf directory.
- Go to \webapps\axis2\WEB-INF, add the following lines to web.xml.
tag defines the url where to bind security constraints. Also, you can specifically define this security config for a specific service on axis2. - Start tomcat and test default web service(Version) on Axis2. There is little button “aut” written on its label, in soapUI test window. I fill the username and password as I set in tomcat-users-xml and select authorization type “preemptive”. Send the request and everything will work fine. If credentials are not supplied, ClientProtocolException will occur and logged in “soapui logs.”
1
2
3
4
5
| < tomcat-users > <!-- other tomcat user definitions… --> < role rolename = "wsclient" ></ role > < user password = "pass" roles = "wsclient" username = "client" ></ user > </ tomcat-users > |
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
| <!-- SECURITY CONFIG --> < security-constraint > < web-resource-collection > < web-resource-name >secured services</ web-resource-name > < url-pattern >/axis2/services</ url-pattern > </ web-resource-collection > < auth-constraint > < role-name >wsclient</ role-name > </ auth-constraint > </ security-constraint > < login-config > < auth-method >BASIC</ auth-method > < realm-name >wsclient</ realm-name > </ login-config > <!-- END OF SECURITY CONFIG --> |
ERROR:Exception in request: org.apache.http.client.ClientProtocolException ERROR:An error occured [org.apache.http.client.ClientProtocolException], see error log for details
No comments:
Post a Comment