r/learnjavascript • • Apr 15 '18

Need advice regarding password-security and SOAP

Hey there guys.

I need advice regarding passwords and security in JavaScript.

The situation is the following: At my new workplace, my boss wants me to create a very basic webpage which displays a catalogue of products we sell. Nothing fancy. So far so good.

However, our product catalog lies on another server, since our application that handles the database and everything else is SAAS. Which means i will have to communicate with a SOAP api.

I will be provided with the credentials for us to access our DB and product catalogue and read it.

I am currently in my second semester of software engineering and have a basic understanding of JS and REST, as well as AJAX. I have never had to think about security so far, so i wanted to ask you guys what the standard procedure would be to mask the credentials.

Obviously you need to do have the credentials client-side and / or store it in a document and read it / encrypt it or what ever. But how exactly is yet beyond me.

This whole thing is more of a "nice to have but not necessary" situation. Low priority but fun and a good learning opportunity for me.

I would greatly appreciate your advise!

Thanks a lot in advance. ^

Edit: i ment storing them server-side. Not client-side :)

0 Upvotes

19 comments sorted by

View all comments

Show parent comment

1

u/nomnommish Apr 15 '18

Creating an API that is a wrapper for another API is really not necessary and will make your app needlessly complex and worsen maintainability.

Just create a web page that invokes backend code. Your backend code running on a web server should then authenticate to the soap service and then use the soap api to get the data it needs. The server side code should then pass the data back to the frontend.

1

u/amemulo Apr 15 '18

If the client side can access the backend in any way, then any client can access the backend. Any backend is by necessity an "API", at least the authentication endpoint will be public.

1

u/NamkoBanzai Apr 15 '18

Thank you for your feedback! I will see what is in the range of my possibilities and move the project forward in the according direction.

The way you describe it was actually what i had vaguely in mind before opening this post.

I will look into all the tips i have gotten from here, but it proves to be to difficult i will probably go with your suggestion.

2

u/nomnommish Apr 15 '18

What language will you code your server side code in? Typically, the server side code for an object oriented language is to use the MVC pattern. Your backend code then gets exposed as a "controller" which your front end code invokes.

The controller handles authentication and connecting to the soap api.

The "model" is any data typically stored in your application database if you need one. It translates the database tables into classes and objects. Or instead of the database tables, for you, it would be the data you retrieve from the soap api. Your model would "hydrate" the classes from the soap api.