Question

Hi I need some help writing a security code using python mongodb restful api. I just...

Hi I need some help writing a security code using python mongodb restful api. I just need help on how to provide a security login to user to enter their username and password or to have a block in using extra access once they have logined and they want more access to the databases they will be force to sign out of the server but I just do not know how to start on it can someone show me how to write a security code to allow users to enter a username and password or just block the user for accessing extra databases. Thank you

Also it should be in visual studios

I just need a way to write a code for security for my python mongodb project to let users when running the code to insert their username and password and it will block the user to have more access to the database after they enter their username and password it should make them only to use one database at a time and they cannot use extra access to use the databases I just need some kind of security using PYTHON MONGODB and Restful API
0 0
Add a comment Improve this question Transcribed image text
Answer #1

Hi,

MongoDB is a document oriented ,open source database program that is platform independent. MongoDB stores its data in documents using a JSON structure . This is what allows the data to be so flexible and not require a schema. MongoDB installation were left open to listen to any interface  thus anyone could connect to your database. So in order to provide security,adding authentication for your mongoDB database is necessary. This is an additional layer of security,if you leave your network interfaces open ,and want to ensure that there is additional security measure.

Adding authentication for your MongoDB means that for anyone connect to your database they will need to provide login and password to actually read and modify data.

Before you enable authentication on MongoDB ,it is suggested to create a root user account, so you could manage other users without the need to disable authentication.

# Enter Mongo console

mongo

# switch database to the admin database

use admin

# add your user with root permission

db.createUser({user:"admin",pwd:"secure_password",roles:[{role:"root",db:"admin"}]})

Next step is to connect to your database server and run

# Enter Mongo console

mongo

# Switch database to countly

use countly

# Add your user with read and write permission to this database

db,createUser({user:"test",pwd:"test123",roles: [{role:"readwrite",db:"countly"}]})

# Switch database to countlyfs

use countlyfs

# Add your user with database read and write permission to this database

db.createUser({user:"test", pwd:"test123", roles:[{role:"readwrite", db:"countly_fs"}]})

# switch database to countly_out

use countly_out

# add your user with read and write permission to this database

db.createUser({user:"test", pwd:"test123", roles[{role:"readwrite",db:"countly_out"}]})

Next step is to setup authentication information to countly,so it can connect to your database and use it properly.Here it is providing the encrypted password before saving it in configuration file .Now we need to modify 2 configuration files to provide credentials .The modification is given below:

mongodb: {

host: "localhost",

db:"countly",

port: give port

max_pool_size: give pool size

// providing user name

username:"test",

//providing encrypted password

password: enter encrypted password

// mongos :false ,

// only providing this ,if you are authenticating through other db

dboptions:{

// name of authentication db is admin

// only needed if you are using one user for all databases

authSource: "admin"

}

Hope you help this ..

Thank you...

Add a comment
Know the answer?
Add Answer to:
Hi I need some help writing a security code using python mongodb restful api. I just...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • I need help with my homework assignment Linux systems keep user account information in the passwd...

    I need help with my homework assignment Linux systems keep user account information in the passwd file and the encrypted password in the shadow file. The passwd file containing account information might look like this: smithj:x:1001:1001:John Smith:/home/smithj:/bin/bash The shadow file containing password and account expiration information for users might look like this: smithj:KJDKKkkLLjjwlnttqoiybnm.:10063:0:99999:7::: The fields in the shadow file are separated by a colon, with the first field being the username and the second being the password. Under normal circumstances,...

  • I need help ASAP on this, this is due at midnight PST. This is the current...

    I need help ASAP on this, this is due at midnight PST. This is the current code I have. How can I allow the user to quit. My counting while loop works fine, but I would like it to not keep outputting username if a file was successfully opened. This is what is required. Prompt You have assumed the role of managing the technology infrastructure at a zoo. You will develop a working program (either an authentication system or a...

  • Hi, I need some help writing matlab code for the conversion of a greyscale image to...

    Hi, I need some help writing matlab code for the conversion of a greyscale image to 8-bit per pixel greyscale, using block truncation coding. Can someone please provide some code for me to use?

  • I'm just a beginner in programming,how to make this program more simple without using #include<iostream> and #include<redex> here is the question Terms to know: If-else statement,for.....

    I'm just a beginner in programming,how to make this program more simple without using #include<iostream> and #include<redex> here is the question Terms to know: If-else statement,for..while..do while,loops,pointer,address,continue,return,break. Create a C++ program which contain a function to ask user to enter user ID and password. The passwordmust contain at least 6 alphanumeric characters, 1 of the symbols !.@,#,$,%,^,&,* and 1 capital letter.The maximum allowable password is 20. Save the information. Test the program by entering the User ID and password. The...

  • LANGUAGE JAVASCRIPT, PHP Need help with PHP and ajax code. The user needs to login but,...

    LANGUAGE JAVASCRIPT, PHP Need help with PHP and ajax code. The user needs to login but, I keep getting an error that I coded "Wrong username and password!" ***PLEASE DONT GIVE ME A NEW CODE THAT IS NOWHERE NEAR THE CODE I SUBMITTED***** PLEASE LOOK AT THE CODE AND SEE ANY ISSUES login.html <!DOCTYPE html> <html> <head> <title>login popup</title> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script> <style type="text/css"> body { background-color: white; } </style> </head> <body> <center> <h1 style="text-align: center;"> Login </h1> <form>             Login ID:...

  • I need help creating a netbeans application and linking database with steps Part II – Next,...

    I need help creating a netbeans application and linking database with steps Part II – Next, build a simple Servlet called LoginServlet in your “Bank” Project. Now make it so that when the Customer logs in, the LoginServlet will get called and will validate the user id and password. At first, just make sure that the Servlet gets called correctly. So just print a simple message like “LoginServlet Running…”. Remember, to call the LoginServlet, you will need to modify the...

  • Lab 4: Databased Admin Tool Continued Python Objective: In the previous lab, you developed an admin tool for username an...

    Lab 4: Databased Admin Tool Continued Python Objective: In the previous lab, you developed an admin tool for username and password management. You accomplished the tasks with Dictionary or List. Here, use class to design your own data structure to accomplish a similar task. The UD.txt datafile: FIRST NAME, LAST NAME,USERNAME,PASSWORD Sam, DDal,sdd233,Pad231 Dave, Dcon,dcf987, BHYW4fw Dell, Grant,dgr803,Sb83d2d Mike, Kress,mkr212,UNNHS322 Lisa,Kate,lki065,dgw6234 Paul,Edward,ped332,9891ds Youyou,Tranten,ytr876,dsid21kk Nomi,Mhanken,nmh223,3282jd3d2 Write a program that imports the database from UD.txt, your program can search for users’ password....

  • Hi, I need help writing a code for this. The language is python 3, and we...

    Hi, I need help writing a code for this. The language is python 3, and we cannot use things like break, continue, exit(), lambda, map, filter, raise, try, except, and assert in our code. Thank you! We must write a function called "binary_to_decimal(binary_number)" that takes a string for a binary number and output the decimal integer for that number. The solution, aka the code, MUST contain a for loop of this form (power is an integer variable you define earlier):...

  • Android Problem Using JAVA Problem: You need to create an app on Android Studios that allows...

    Android Problem Using JAVA Problem: You need to create an app on Android Studios that allows users to register and login into the system. The focus of this project is for you to create an app with several activities and has data validation. You should have for your app: A welcome screen (splash screen) with your app name and a picture. You should then move to a screen that asks the user for either to log in or to register....

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT