- CouchDB and PHP Web Development Beginner’s Guide
- Tim Juravich
- 213字
- 2021-08-13 18:22:55
Time for action — checking to make sure the database is secure
Your _users
database should be secure, so that only admins can read or alter the structure of the database. Let's quickly test this:
- Open Terminal.
- Try to read the user document again by running the following command. Again, replace
your_username
with the username of the service admin that you just created:curl localhost:5984/_users/org.couchdb.user:your_username
- Terminal will respond with the following:
{"error":"unauthorized","reason":"You are not authorized to access this db."}
What just happened?
With the CouchDB instance out of Admin Party mode, the authentication module stepped in to make sure that anonymous users couldn't read the database.
If you were to play around with the command line again, you would be restricted by doing anything with the _users
database, but you would also notice that the test-db
database is operating just as it was before, perfect! That's exactly what we wanted. You might be asking how do I access the _users
database through the command line, now that security is enabled? You have to show that you are an admin by passing your credentials to the RESTful JSON API.
推薦閱讀
- Android應用程序開發與典型案例
- C語言程序設計(第3版)
- 大學計算機應用基礎實踐教程
- Python高級編程
- Banana Pi Cookbook
- 基于Swift語言的iOS App 商業實戰教程
- 組態軟件技術與應用
- 深入分布式緩存:從原理到實踐
- Learning Nessus for Penetration Testing
- Python預測之美:數據分析與算法實戰(雙色)
- Java多線程并發體系實戰(微課視頻版)
- Beginning C# 7 Hands-On:The Core Language
- Python深度學習(第2版)
- Hands-On GUI Application Development in Go
- Procedural Content Generation for Unity Game Development