Wrox Programmer Forums
Go Back   Wrox Programmer Forums > C# and C > C# 1.0 > C#
|
C# Programming questions specific to the Microsoft C# language. See also the forum Beginning Visual C# to discuss that specific Wrox book and code.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the C# section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old July 16th, 2005, 03:37 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 440
Thanks: 0
Thanked 0 Times in 0 Posts
Default Web service users and roles...

Hey guys and girls!

I am trying to come up with an idea to how user handling at a web service can be done. No ideas seem to appear...

The problem is as follows. I have a web service which should give access to specific web methods for some users, and to other methods for other users. Different users can have different roles. But I don't know how to go about this.

Is there a secure way to retrieve and pass username and password to the web service? Or is this a bad idea?

At the web service I have made a configuration file, which specifies the users together with information about their role. But don't know where to go from here.

Should I pass the user information for each web request or is there a way to have a session or like through web services?

Thanks, Jacob.

Ups, I guess I posted it in the wrong forum, sorry. I am doing the implementation in C# ;)
__________________
Danish audio books for download at http://www.lytenbog.dk (Danske lydbøger til download).
 
Old July 22nd, 2005, 05:31 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 453
Thanks: 0
Thanked 1 Time in 1 Post
Send a message via AIM to Ankur_Verma Send a message via MSN to Ankur_Verma
Default

I think the username and password should only be passed once using the public private key pair in combination with a an encryption when for sharing the public key for the first time. Or you can use SSL if thats possible.
Once the user is authenticated you should simulate what cookies do. that is pass a token associated for each authenticated client as one of the arguments in each method call. This approach calls for a little extra programming effort but sould serve the purpose.

That was kind of a quick response, but I would more than like it if you wanna discuss it further.



Regards
Ankur Verma
 
Old July 22nd, 2005, 06:24 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 440
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Alright, thank you for answering. I also posted this one after I got a little smarter about the authentication/authorization dilemma.

http://p2p.wrox.com/topic.asp?TOPIC_ID=32962

Previously, I have never dealt with authentication/authorization related to web services, so do not know how it works. Moreover, I would like it to work with Mono as you can see in the above thread.

By passing a token for each method call can't fake users just do brute force attacks faking the token? Try different tokens, or im I way off? Web services are pretty much to be considered stateless unless sessions are used, and that is what you mean when you mention cookies right?

As I described in the above link I found some stuff about passing the user credentials in the header and I later found this article...

http://archive.devx.com/security/art...602/ps0602.asp

... which I have thought about. However, I have a time limit on my project. Deadline on August 1st, why I probably will not get time for implementation. Will perhaps try the SOAP header solution in the above article later.

Jacob.
 
Old July 22nd, 2005, 07:58 AM
Registered User
 
Join Date: Jul 2005
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The SOAP header solution coupled with a good encryption scheme works real well.

You are right in thinking that someone can hack a plain text SOAP header solution. It's really not even a hack. If they get hold of the header it's plain as day. If however you encrypt the credeitals as you pass them over the wire you have a better shot at staying safe.
 
Old July 22nd, 2005, 09:08 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 440
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks dewalt, I think I will look into this solution then. I like the fact that you do not have to have additional parameters for the web method etc.

Unfortunately, I am totally blank when it comes to the encryption using C#, but I think the SOAP header solution implemented at the link I posted have some code I can look in.

As mentioned, I am trying to make the framework run on both Windows and Linux (with Mono), but without an understanding of how the authentication is done this is difficult. It would be nice if authentication came out-of-the-box, and I could authorize myself based on the User.Credentials.Name.

Perhaps if I knew how to enable Basic authentication between the consumer and the web service, that I could make it work. The authentication mode in the web.config file says Windows, but I guess that I have to set it up on the web server running the service on the Linux box, right?

Added after the above; I guess that Basic is only for Windows too. I have to do a custom solution.

Jacob.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Selecting Users of particular Roles snbelani BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 1 June 2nd, 2008 04:14 PM
error in web.config when using roles hertendreef ASP.NET 2.0 Professional 2 March 8th, 2008 05:47 AM
Web Service Consuming another web service CraigWhitfield EJB 0 January 10th, 2008 08:38 AM
roles and users in bugbase mrco BOOK: ASP.NET 2.0 Instant Results ISBN: 978-0-471-74951-6 3 February 6th, 2007 12:32 PM
Service Oriented Web Service aldwinenriquez .NET Web Services 2 September 15th, 2005 03:25 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.