Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
5.00/5 (2 votes)
See more:
Hi I have a question, perhaps someone can help me out.

I have created a web service in Java which I will then deploy for my clients to use. So far so good.

I will not create the client application myself. I will simply expose the web service, then the clients will create their own tools which connect to it.

So first question, I need a method of logging in. I already have username and password functionality in my software but not in my web service. What I was thinking was something along the following lines.

Client -> Web Service - Login(username, password)
Web Service -> Client - return LoginObject (Contains if successful or not among other things)

Client -> Web Service - DoSomething(LoginObject, param1, param 2)
Web Service -> Client - return success/fail

I want the client to make use of this LoginObject in order to send it along when performing the DoSomething method. Obviously the attributes of this class will be read only. If im writing this class library in java, and my client is using c# i can see problems for this, and I dont want to create the class library for every programming language they will use.

I was wondering what the industry standard way of doing such a thing is. Any ideas?

Thank you very much for your time in advance :)
James
Posted
Comments
Nagy Vilmos 8-Apr-11 16:49pm    
Just want to say good Question! I maybe have an answer but it'll take a bit to make clear.

1 solution

You should implement a JWT-based solution. Google "JWT" or "JSON Web Token" and you will find many links about how to implement JWT. Here is a link to Wikipedia to get you started: JSON Web Token - Wikipedia[^]
 
Share this answer
 
v2
Comments
Richard MacCutchan 1-Dec-20 3:46am    
Did you notice the date on this question?
Richard Deeming 1-Dec-20 3:59am    
It's an unanswered question, and the solution looks reasonable. It probably won't help the OP, but it might help someone else who finds the question via Google.

However, I've replaced the Google tracking link with the target Wikipedia URL.
Richard MacCutchan 1-Dec-20 4:27am    
That is why I merely asked the question. It is possible this post was a spam target and appeared at the top of the queue.
TimWallace 10-Dec-20 19:59pm    
Aw, man, I totally missed that! Thanks for the update.
Richard MacCutchan 11-Dec-20 5:53am    
We have all done it. :)

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900