views:

81

answers:

3

Im using asp.net mvc and form to log in user. I am wondering if there is any issue with using jquery to log in user instead and what I should be concerned about in terms of security as well. thanks

EDIT: I ONLY MEAN PASSING THE USERNAME AND PASSWORD TO THE MVC CONTROLLER. THE SITE USES A LOT OF JAVASCRIPT.

+4  A: 

In 99% of web applications JS should always give some extra (additional) functionality or take control over basic functionality (like log in, send a message etc.). But this basic functionality should not rely only on JS.

Remember that there is a small group of users who don't use JavaScript, or use browsers that don't support it at all, and they shouldn't be ignored.

Crozin
Or folks who use addons like NoScript - http://noscript.net/.
Dan Atkinson
Personally, I think that depends. A web*site*, I agree. A web*application* is a different story. If the app relies heavily on jquery already, making it required for login should be no big deal.
jvenema
By webapplication I meant just a typical website. If our application (I don't like to use this term in *web* context :]) depends on JS/Flash or any "non-HTML" technologies then it doesn't have to provide "static version".
Crozin
+2  A: 

jQuery will not handle authentication, it would only serve as an intermediary, passing, say, username and password to your authentication code inside your application. There's no harm in having jQuery manipulate a login screen or whatever, but in the end, server side code will be what logs a user in.

EDIT: Any JavaScript you include on your site, jQuery or not, will need to be vetted for security. Have a look at this slide deck: Douglas Crockford: Ajax Security to get an overview of the issues. Security is a process though, and you need also to look at your server side code to assure it also is meeting your expectations with regard to security.

artlung
I think the question is more related more to the security implications of doing it using jQuery to post the data, rather than if it can all be done in some jQuery api call.
Dan Atkinson
A: 

I would look at hashing the password before sending it to the server.

Then you check the username and hashed password against the username and hashed password in the db (since you shouldn't store passwords in cleartext anyway).

Dan Atkinson
If there is concern around the PW then SSL should be used. Anything you do with javascript can easily be reverse engineered.
Chuck Conway
+1! Indeed. Logging in via SSL would be a preferred method.
Dan Atkinson