Hello and welcome to the New York, this project, following this project will discuss what is basically
what is the meaning of authentication and security.
The fact that I tell you what, that's why I've said it, so it is a package that allows to look for
the body of the post request and finish the data based on the name of my input.
OK.
Let's see one example.
For example, I'll be going to my registered or.
You can see I'm having my email and password.
So for this input, I'm having a name call password and for this input I'm having a name called username.
So what this body posture does is it allows to look through the body of the post request.
So this is the post request so that who make them to go to the body of the post request and fetch the
data based on name of the input.
OK, we can get the database and the name of the defeat.
Like if you use this password, then we can get that data that the user is entering in this input.
OK, so that is right.
This body part that is used.
So here you are, Lexton.
You are encoded extended to meet the encoding, what type of encoding it should be in a text format,
right?
So that's when we have for you this.
So we can also see over here.
Just wait a minute, I will show you.
Yeah.
So once the user is.
Registering then you can see your request, dot boarded our passport.
So using the body, we are getting the passport, get out.
You can see when the user is logging in using the requested border username.
The request is the request by the client.
That means, for example, if you see your post in the log in, no doubt the user is sending a request
and also in the request.
What we are doing this faster than you are related to a database that we can see in the later parts
are not just focus on the signal line.
OK.
This way you don't just focus on the signal.
Whenever the user is using accessing this logging road and then posting a request, then a request that
boarded-up username.
We are fetching the, you know, the doc, the user name from this big question why did I do that?
Eventually adding that instead of variable called user and not dissimilar to password?
So this is what it is allowing us to do.
OK, so basically we are going through the body of the post request and fetching the database on the
name of the input.
OK, so that is how we use this for 40 percent.
Now, let us dive into authentication and security.
So what does authentication of security means?
It means securing our data.
As you know, day by day, we have seen many activities like our data being left and you can see many
data breaches around the world and all this kind of stuff.
So when like when you see some movies in those, they will show the people who are working in cyber
security to hack us.
So I show you a website.
It's a good website to prank your friends, hacker Typekit dot com.
You click on Stop Hacking and just enter some random, you know, some random picture like this.
Keep on clicking it, then it will write some food I'm just clicking on and that's they have just put
my finger on it.
OK.
It shows that you're hacking something offensive, it's a nice prank.
So this is what they're basically in many ways they show what security and authentication is, but it's
not.
It's basically it's also a web development practice where we should secure the username password and
the details of the client's safe from the attackers.
There can be potential threats that we have to be aware of.
So, for example, there can be a network, but it's like that can be one weak system where there is
a threat so that what attacker will do, he'll target that system and then he will get into that network
where the system is connected.
So it's not only the loss of the system, it's also the loss of the whole network, for example, one
end system.
If, for example, are working in an office.
OK, let me show you.
Example, you are working in your office.
And then this is your end system.
This is your end system, and there is a big sign out of your office.
And then you're connected to your office through this end system once attacker.
Attacks your system and your system gets compromised.
That means he goes into the network and the whole server gets compromised.
So that should not happen, right?
So that's where endpoint security is very important.
So you have to not allow the attacker to enter into your system.
So how to do that?
There are various ways in computer networking, so you can use tools such as Wireshark then map to analyze
the traffic, to only send the traffic that is authenticated and everything.
This is basically authentication is a good security means creating an algorithm so that your data is
safe.
Authentication means based on the security of algorithms authenticating the user's OK based on the data
that they're providing before signing in, not logging up something what you say.
So how do to like what you think by.
You know, my basic security and also so how to do that, so we know how to like how to use and enforce
that should not be visible to others, should also not be visible to the bedside.
For example, if we are using Google, we are using Facebook.
Then if our passwords are known by Facebook people, then someone in the Facebook organization may use
it as like they can use that they can leak the data, which causes data breach, and then we may have
a loss of economy or something.
So even the providers, the service providers should also not know a lot of passwords.
So that is the main thing.
So that means there should be a mechanism.
So we will see that mechanisms by level, by level.
It's the first of it is just registering the users with username and password.
OK.
This registered the users with username and password, so I use notepad over here.
So first thing, what you will do.
So basically, you.
Coming up to a MongoDB database.
So I write that steps, I'm going to show the court related to that.
The first thing is you have to have a database to store the username and password.
Second thing, once you're having the database.
You need to create a keep up with the database.
Create a schema, but the database towards schema means that means like, for example, the database
name in your database, you may have many tables.
So since we are using new skill, that means so no sequential language, the data will be in the form
of documents in the form of JSON objects like JavaScript objects.
So if you are using a school sequential sequential language, that means it will be in the form of tablets.
My skill post get a sequel and those things.
But now here we are using MongoDB.
It will be in the form of documents, so we have to create some data structure for the document, like
what the document should contain, what should be the name of the variable that we are storing and send
the document.
So basically, it's username and password, right?
That.
Now.
We have to create a new user document when the user posted a crossing register, right?
Create new user.
Document.
When you use it post a request to slash the gesture.
That means get access to the registered rope.
OK.
You open the register and then he enter Emeli entered password and everything he click, Don't register
when you click, don't register.
We have to do the basic valuation validation.
That means like basic means.
So for example, if you click some random picture and they can't register, it will say that email address
should include an extra symbol.
This is the basic allergen like it can be anything at the rescue, even if this year clicking registered
registered because it just checks for the basic validation.
OK, so since we don't want that, I'll delete that from my documents yet.
We just refresh it.
Yeah, see, yet a name has been created and we are having salt and hash that we have seen the following
videos.
So basically, we are not able to see that password, right?
So this is sort of be the fourth and fifth level variants will not be even the servers will not be able
to see the password.
It will be in the form of salt and hash.
OK, so deleted as a correction.
So this is what happened, didn't check for the basic validation and then allowed the registration process.
OK, so that is what we have to do the third step.
We know that it makes it a question that the user documented inside the MongoDB.
So far, the MongoDB database will be using them on campus.
Com Companies are, you know, do you wait for MongoDB can also use inside show inside data analytics,
the hypertension.
So we can do this or basically will be I'll be using hyper terminology.
You can use any terminal like Linux Terminal or in or we export terminal or anything.
But in this course, I'll be using the Typekit because it has a lot of good customizations and all kinds
of stuff.
It looks good to see you again soon.
So, yeah, and also that it will be a visual studio code that I'll be using because it has a lot of
snippets and packages to strong.
So we'll get into this.
So this is the third step, this is the I'm talking about the first step in this axiom.
They use this to the username and password entered by the users inside the.
Database 14, if Blank posted to through logging road, we have to check with this email and its corresponding
password exists in our database.
If logging.
South.
Then check if the credentials.
At present.
In the database or not.
OK.
If someone is asking for a log in, like if they don't keep a log in and entering the and password,
then we have to check whether the login credentials are present in the database or not.
These are forced if the database matches with the credentials, then within opening this week that you
know the feed newsfeed page where you can post message posts and everything.
But this the court is very simple.
What we have to do at issue, first thing cannot be the MongoDB, etcetera.
So how to connect to the MongoDB server?
One simple line.
First thing, you have to import mangoes.
So how to import mangoes?
Open your terminal and then just click on.
And being.
Install Mongoose.
And then it would install once installed, you can require it once required, then you can now just
use this single line so that it will get back to Mungo's Dock Connect.
MongoDB localhost two seven zero one seven slash.
This will be the name of the database that we are creating for.
The database will be creating a users database, so I'll give the name users DB.
This thing is for sometimes the version can be older, like every time it will get updated.
Since it's open source, everyone will update it.
So we have a standard version and you don't have any, you know, some any errors kind of thing passing
it, then we have to do this.
So this is basically if you're getting alerts for getting any ideas other than this, then just copy
paste data that you get in the terminal based in Google, search for Stack Overflow, so every programmer
should use Stack Overflow for must.
So whenever you are in doubt?
Yes, useful.
Yes.
They added that the terminal gives just copy.
Paste it in the Google and you'll get the solution for the error.
Someone, someone or that any one of them would have already got that error in their earlier programming
or carrier.
OK, so once you are connected with the database, with the MongoDB database, the next step is to create
the user schema.
As I said it creating the user schema, creating you me this line, the constant user schema as equals
to new mongoose schema.
And then in such scheme, a watch, we should have the data structure that basically these three things
they can just comment it for now.
OK, so that we only need user name and string.
We don't need Google any Facebook.
It is secret and on government.
That's not our problem.
So this is how the user schema looks like.
So offer the user schema, we have to create the user model like the user, a, you know, user document.
So the user document we have sending the user a schema.
So this will be the name of the collection.
So one thing you have to remember is first thing is document.
So first thing is database database consists of collections.
And collections, guns are soft documents.
Right.
So database is the name of the database that is used to be.
So the collection name is use it.
But this is the name of the collection inside the US collection.
We'll have the documents.
So now we have completed the first three steps.
So the first two steps now that that's to create you is a document when news reports are requested that
it is still.
So where is the dog?
Get registered?
So here is nobody.
All this phone will be given to you.
You can check through the port.
So first, your basic know what you have to do is to just understand this.
Get their sense of the concept.
To get the vote vote when rendering, I just said, OK, what we are asking for for statements, and
you can also request that additional get means when the user access.
So you are like when you are world becomes localized, like when this is the you warrant.
What we have to render to the plane forced it, which means in this you are Lebanese clicking something
submitting to that like me when the client is sending data to the server, that is request.
So here in politics, we have to search for Abbott first major general.
Yeah, so here you can see Abbott -- registered.
So yeah, there is a big thing like you said or registered and everything.
Don't add up everything of this thing because this is this comes in the later part, later security
level.
One thing you have to remember is whenever user clicks unregister, the app is simply user, not registered
user name password.
So you going means are calling this collection because the name of the collection has been saw before,
and then we are registering him with the username and password like basically we are destroying the
username and password.
How we are getting the username and password by using the body parts.
As I said in the earlier radio, ad lib industry only earlier requested by Iraqis, and it will get
the username that the user is posting.
Store that inside a username.
That means that the user's key, if you see that having a username and password have been stored there.
This is how we are making the post request.
OK, now next thing off of the post requests, we have to validate, but if the user is picking on logging
so here, as you can see in logging, abduct post logging here.
You're creating a username.
Here, since we are using password, there is no code for authentication, but a simple thing, you
can just call the user data like find that will be one method called fine.
Just let me show you that.
Yeah.
So this one user dot find one.
So find one method will run through this collection and then we'll check whether they had the user name
matched to this user name.
You can use another condition like password call and request body to request anybody, run past it and
then check with it.
If they if it is present, then it will send back the phone to use it.
Otherwise, the error if another will consolidate log data.
If not, if it is found user, then will you know?
We basically render him the secret speech.
So this is the first step of lobbying for this, they're not having the court because the first step
is none of them, none of them will be discussed, simply stating the username and password that he's
giving.
There is nothing encryption, right?
So from the next we have been see how to encrypt the data using database encryption, big hashing,
insulting and then cookies and sessions and then all the stuff that is required.
So for that, we'll have a code and each call what it does and everything.
So with this, we have completed the basic level one that is registering users with do that have been
password checking them and then allowing them to write encryption in it.
So the encryption part will start from the next reader.
See you in the next reading.