Web Service Security java - java

My web service was created some time back using IBM JAX-RPC. As a part of enhancement, I need to provide some security to the existing service.
One way is to provide a handler, all the request and response will pass through that handler only. In the request I can implement some authentication rules for each and every application/user accessing it.
Other than this, What are the possible ways for securing it?
I have heard someting called wsse security for web service. Is it possible to implement it for the JAX-RPC? Or it can be implemented only for JAX-WS? Need some helpful inputs on the wsse security so that i can jump learning it.
Other than handler and wsse security, any other possible way to make a service secure?
Please help.

JAX-RPC and Document-Literal are two different ways of creating SOAP webservices. For adding the security, check out OASIS. You have to add the the policy tag and additional layer of encryption to the SOAP message

Related

Different ways to secure RESTful Web service in java used by one or two clients only?

I have created REST web service in java but need to secure it so that only the authorised clients should be able to access the service. I have never implemented security before. Hence I have no idea where to start to be honest. Do I need to implement any token based security where client need to provide the token in the header of request and I need to verify on my end ?
As RESTful Web Services work with HTTP URL Paths, it is very important to safeguard a RESTful Web Service in the same manner as a website is secured.
For understanding of importance of security consider the following links:
http://howtodoinjava.com/security/restful-web-services-security-guide/
How to secure RESTful web services?
While for Implementation using Spring use the given link:
https://dzone.com/articles/securing-restful-web-service

Web Service wsse security implementation

I am creating a web service using IBM JAX-RPC/JAX-WS. I am trying to implement the wsse security but not able to figure out the exact steps for achieving the same. I will be using RSA 7.5 and Websphere 7 for this web service.
Reading the documentation, I was totally lost since I am new to it and don't have any idea about the same.
Can someone list me the steps for how to implement the wsse security for the web service?
I have been struggling on this since past few days.
EDIT
I want the authentication to be done in the header, it should look something like this:
<header>
<authenticationInfo>
<userID></userID>
<password></password>
</authenticationInfo>
</header>
Other than using the handler and altering the header content, is there some other way to achieve the same?
For web services (SOAP based), the security part is generally handled by web services handlers. Handlers are applicable for both the client and server side. For typical security use case,
On client side, the handlers intercept the request before being send to server and inserts a security header in the SOAP message.
On server side, the handlers intercept the request and check for the SOAP request contains appropriate security headers. This happens before it handled by request handlers.
Here is a nice link on WS security in general I came across. Its not IBM or java specific but an informative read nevertheless.
To answer you question for step by step guide, I could not find any standard RSA 7.5 specific articles but since JAX-RPC is standard specification, it should be same. Here is once such example (Part1,Part2)
WebSphere has built-in support for WS-Security. See http://publib.boulder.ibm.com/infocenter/radhelp/v7r5/topic/com.ibm.webservice.wsfp.doc/topics/csecurews.html.

what is the difference between Restful web services and WSDL? [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
WSDL vs REST Pros and Cons
can any one explain what is the difference between Restful web services and WSDL(Web Service and Description Language). And which one is more secure and how?
Thanks
WSDL is used to describe SOAP services. You're really asking for a comparison of SOAP and REST.
There is no inherent security difference between SOAP and RESTful services. Most likely any security issues will be with your specific implementation of them.
SOAP is more like RPC - it focuses on calling commands on a remote server. REST is resource oriented - you interact with the server by adding, retrieving, updating and deleting resources on the remote server, which corresponds to actions.
eg. With SOAP service you might call an updateAccount(account_id, details) method to save changes, but with a REST service you might PUT information to /account/<account_id>.
In Java, JAX-RS is a good place to start with RESTful services.
WSDL "Web Services Descriptor Language" is the standard for defining the content and behavior of SOAP based web services. It is part of a collection of WS* standards that define "Web Services". These standards cover discovery, transport, message format, authentication, non-repudation etc. etc.. These are formal standards managed by W3C.
REST is a style of network programming where every request is made in the form of a valid URL to identify the "key" of the object in combination with an http GET, PUT, POST, or DELETE action to identify what you want to do to it.
REST is a style rather than a standard messages can be in XML, JSON or any format you choose.
My opinion is that REST is great for doing simple things simply. SOAP etc. is great for complex "enterprise" level interactions with sophisticated security and workflow requirements, but, its overkill for simpler services.
As for security REST does not help you. But using standard web security (sessions, cookies, SSL etc. ) you can secure a RESTful service pretty well.
SOAP has built in bulletproof security but its configuration heavy requiring LDAP servers and managing public/private key pairs. Unless you really need it its best left alone.

Is there a better way of manipulating SOAP messages than Jaxws SOAP Handler Interceptor before the message gets to the container?

I am currently using the jaxws and apache CXF framework to create webservices using the top down approach.
I am using the SOAP interceptors to add remove SOAP header elements, using SAAJ, before the message gets to the container, and the container maps the SOAP action too the java method. I am doing this to create Security Token Services (STS) to facilitate a lite implementation of the SAML2 Profile - converting authentication details into portable identities (SAML Authentication Assertions).
I cannot help think there must be an easier way to do this. Is there a framework that will allow me to manipulate the message with more ease? and if so a tutorial would help.
Many thanks
To change things in SOAP messages you must use SOAP Handlers.
Maybe easier way to do it is changing the way you are securing your web service, if you use a WS-Security way of doing things, our container will work with it fine, and you don't need the handlers anymore.

xfire: Intercepting Webservice header information

I have some webservices exposed through xfire and want to have security around those webservice calls. How can I add security without changing anything inside the web services? Basically I want to intercept these webservice calls before it is reaching actual webservice and to authenticate those calls. Please help me
Regards
Vishal G
Sounds like a job for Spring Security. It can provide security around an existing non-Spring application without any internal modification.

Categories

Resources