Eve: Building RESTful APIs with MongoDB and Flask Transcripts
Chapter: Appendix: Deploying MongoDB
Lecture: Concept: Adding authentication to MongoDB
0:01 Now let's see about enabling access control,
0:03 we're going to connect to the shell like we have been,
0:05 again specifying the extra things like ssl, import and so on,
0:08 we're going to say use the admin database
0:11 and then we want to create a user, I set the user to pwd
0:13 and do not forget the roles this is very important.
0:17 Once we've done this, this doesn't magically make authentication work,
0:20 we have to go over to our Mongo config
0:22 and say security authorization is enabled, then we want to talk to it,
0:27 we can now pass the port, the, ssl stuff,
0:32 the users, the user name, the password- p password
0:35 and authentication database is admin, don't forget that, it doesn't work without it.
0:40 At this point, you've basically set up your MongoDB in a safe way
0:43 the final thing that you might consider,
0:46 and it depends on how you want to run your database and so on,
0:49 and you might set up a replica set to have failover
0:52 and multi machine redundancy and things like that,
0:55 that's certainly a next step that you could take
0:58 but it's beyond the scope of this course so check out the docs.