Use with JSON for a secure login form

So I'm tring to create a secure form ( username & password ) with the usernames and passwords stored stored in a Json fil. So I have some questions.

How can I secure that json file will not be accessible by something coming via cross-domain request? Or How can I ensure it will not.

How do I actually use the .post() the function with json. I mean I read the .post() documentation but it doesn't make much sense to me. Not how can I use it with Json at least.

The json variable is something like that: var Arr = secureData.Users;

Any suggestions on how can it be done? It shouldn't be hard from the tutorials that I read but I just don't get it.

PS: I looked into another way but that uses MySQL and PHP but I don't have a MySQL database ( nor want to build one ) and I don't use php at my site.


What exactly are you trying to achieve?

Do you want to compare the username and password entered by the user to values stored in a file on the server? Then you could use .post() to send the values submitted by the user to the server, let the server perform the comparison and return an indication of whether the authentication succeeded. In this case, although it is certainly possible, there is no particular reason to use the JSON format in the file - CSV, XML or anything like that might be just as (or more) appropriate.

EDIT: If you are not using PHP or any other server-side scripting, how do you expect to do the comparison? You obviously do not want to perform the comparison using javascript, since you will then have to send the correct values to the browser. That would obviously make your authentication mechanism very easy to circumvent / hack.

Just do not return/echo the complete JSON string with usernames/passwords in any way.

Need Your Help

Controller side list object in a view Bag. then on html side step through with foreach to produce tables

html list foreach c#-3.0

I have a list that has many objects in it. I want to step through it and for each object i want to create a row. Basically I want a table made. Can anyone please help me.

Multi-Selection in Rails/Formtastic

ruby-on-rails-3 ruby-on-rails-plugins ruby-on-rails-3.2

So I have a Many to Many relationship between Record and Counties in Rails, such that when I am creating a record, the user can select multiple counties. The problem is that there are over 100 cou...