03.05.2015 Views

IBM WebSphere V5.0 Security - CGISecurity

IBM WebSphere V5.0 Security - CGISecurity

IBM WebSphere V5.0 Security - CGISecurity

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Open the Web Service proxy client generated by <strong>WebSphere</strong> Studio Application<br />

Developer. In this class, you will see the methods that we exposed as Web<br />

Services, for example in our case you would see the getBranchBalance and<br />

getCustomerBalance methods; add the following lines to the code.<br />

Example 7-3 Setting user name and password for the SOAP transport<br />

SOAPHTTPConnection soaptransport = new SOAPHTTPConnection();<br />

soaptransport.setUserName("your-userName");<br />

soaptransport.setPassword("your-Password");<br />

call.setSOAPTransport(soaptransport);<br />

Save the proxy class and restart the test environment server. Now, when you test<br />

your Web Service again, if you use TCP/IP Server to check the SOAP request,<br />

the SOAP header will consist of user credentials. However, this information is by<br />

default encrypted using Base64 encryption algorithm, so you won’t be able to<br />

read the user name and password.<br />

HTTP Basic Authentication with SSL<br />

It is very easy to use these Web Services we developed using SSL. Make sure<br />

you have the HTTPS port enabled for your test environment in <strong>WebSphere</strong><br />

Studio by selecting it on server configuration page.<br />

We know the URL for our test Web Service sample is:<br />

http://localhost:9080/itsobank/sample/ConsultationHelper/TestClient.jsp<br />

To use SSL, you just need to change the port number from 9080 to 9443 in the<br />

above URL and check<br />

http://localhost:9443/itsobank/sample/ConsultationHelper/TestClient.jsp<br />

in the browser; you should see the certificate appear.<br />

Secured and non-secured services together<br />

It is possible that we need to secure some services and not others. Even for the<br />

services we do secure, it is true that if all those services are accessed using the<br />

same URL and if a user supplies the credentials for one service, the user can<br />

access any service with this URL. For protection, we need to create different<br />

URLs for each secured service and allow them for different users, groups and<br />

roles.<br />

For example, create two servlet URLs; one is protected and one is not. If you<br />

look at the web.xml sample below, you will find that this is very simple, as you<br />

only have to create another URL for services.This security configuration is<br />

discussed in the above sections.<br />

Chapter 7. Securing Enterprise Integration components 145

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!