tags:

views:

46

answers:

2

Assume I have a method in my WCF Service implementation called Login and it is defined as follows:

[OperationContract]
[WebGet(UriTemplate="login/{username}/{password}")]
bool Login(string username, string password);

Obviously, passing something like http://localhost:80/login/user1/pass1 is not very secure, so how is the is normally handled in a wcf rest scenario?

A: 

One option would be to run your whole site as SSL.

The other as you mention is to send the user name and password in a POST.

Is there a requirement that is forcing you to do this in JS?

Shiraz Bhaiji
WCF is sort of new to me. Basically, I need an android app to login to the application by doing http://app.com/user/pass, but I don't want to show the user or pass in plain text at least. Can you clarify (show example) of what you mean by sending the username and password in a POST? Does this mean I would have to have two methods, a POST (send user and pass) and a GET (Get value like success login or fail login) or can I retrieve a success and fail message with a POST as well.
Xaisoft
A: 

The other option would be to do some client side encryption, where the user and password are encrypted via javascript, converted to base64, then called the way you have shown in your code.

This is obviously less safe, because if an attacker knows how you are doing your encryption (by examining your javascript code), then he has a leg up on breaking your encryption. But this, combined with SSL, might be a viable solution for you depending on the sensitivity of your site.

Coding Gorilla