Skip to content

Commit c3b3b5e

Browse files
committed
Code review fixes (2/x)
1 parent b2fba28 commit c3b3b5e

File tree

5 files changed

+47
-9
lines changed

5 files changed

+47
-9
lines changed

django_mongodb_backend/schema.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@
55
from pymongo.encryption import ClientEncryption
66
from pymongo.operations import SearchIndexModel
77

8+
from django_mongodb_backend.indexes import SearchIndex
9+
810
from .fields import EmbeddedModelField
911
from .gis.schema import GISSchemaEditor
10-
from .indexes import SearchIndex
1112
from .model_utils import model_has_encrypted_fields
1213
from .query import wrap_database_errors
1314
from .utils import OperationCollector

docs/source/howto/queryable-encryption.rst

Lines changed: 29 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,12 @@ Configuring the ``DATABASES`` setting
2727
=====================================
2828

2929
In addition to :ref:`configuring-databases-setting`, you must also configure an
30-
encrypted database in your ``DATABASES`` setting.
30+
encrypted database in your :setting:`django:DATABASES` setting.
3131

3232
This database will be used to store encrypted fields in your models. The
3333
following example shows how to configure an encrypted database using the
34-
``AutoEncryptionOpts`` from the ``pymongo.encryption_options`` module.
34+
:class:`pymongo.encryption_options.AutoEncryptionOpts` from the
35+
:mod:`pymongo.encryption_options` module.
3536

3637
This example uses a local KMS provider and a key vault namespace for storing
3738
encryption keys.
@@ -60,9 +61,10 @@ encryption keys.
6061
Configuring the ``DATABASE_ROUTERS`` setting
6162
============================================
6263

63-
Similar to :ref:`configuring-database-routers-setting` for using embedded
64-
models, to use Queryable Encryption, you must also configure the
65-
``DATABASE_ROUTERS`` setting to route queries to the encrypted database.
64+
Similar to :ref:`configuring-database-routers-setting` for using :doc:`embedded
65+
models </topics/embedded-models>`, to use Queryable Encryption you must also
66+
configure the :setting:`django:DATABASE_ROUTERS` setting to route queries to the
67+
encrypted database.
6668

6769
This is done by adding a custom router that routes queries to the encrypted
6870
database based on the model's metadata. The following example shows how to
@@ -94,3 +96,25 @@ configure a custom router for Queryable Encryption:
9496
9597
Configuring KMS Providers
9698
=========================
99+
100+
To use Queryable Encryption, you must configure a Key Management Service (KMS)
101+
provider. The KMS provider is responsible for managing the encryption keys used
102+
to encrypt and decrypt data. The following table summarizes the available KMS
103+
provider options and how to configure them:
104+
105+
+-------------------------------------------------------------------------+---------------------------------------+
106+
| :setting:`KMS_CREDENTIALS <DATABASE-KMS-CREDENTIALS>` | A dictionary of Key Management |
107+
| | Service (KMS) credentials |
108+
| | configured in the |
109+
| | :setting:`django:DATABASES` |
110+
| | setting. |
111+
+-------------------------------------------------------------------------+---------------------------------------+
112+
| :class:`kms_providers <pymongo.encryption_options.AutoEncryptionOpts>` | Map of KMS provider credentials and |
113+
| | options. The ``kms_providers`` map |
114+
| | values differ by provider and are |
115+
| | required to access KMS services. |
116+
+-------------------------------------------------------------------------+---------------------------------------+
117+
| ``kms_provider`` | A single KMS provider name |
118+
| | configured in your custom database |
119+
| | router. |
120+
+-------------------------------------------------------------------------+---------------------------------------+

docs/source/ref/django-admin.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Available commands
1717
``showencryptedfieldsmap``
1818
--------------------------
1919

20-
.. versionadded:: 5.2.0b2
20+
.. versionadded:: 5.2.0rc1
2121

2222
.. django-admin:: showencryptedfieldsmap
2323

docs/source/ref/models/encrypted-fields.rst

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,17 @@ Encrypted fields
44

55
.. versionadded:: 5.2.0rc1
66

7+
Django MongoDB Backend supports :doc:`manual:core/queryable-encryption`.
8+
9+
See :doc:`/howto/queryable-encryption` for more information on how to use
10+
Queryable Encryption with Django MongoDB Backend.
11+
12+
See the :doc:`Queryable Encryption topic </topics/queryable-encryption>` for
13+
more information on developing applications with Queryable Encryption.
14+
15+
The following fields are supported by Django MongoDB Backend for use with
16+
Queryable Encryption.
17+
718
+----------------------------------------+------------------------------------------------------+
819
| Encrypted Field | Django Field |
920
+========================================+======================================================+

docs/source/ref/settings.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ Key Management Service (KMS) credentials for Queryable Encryption.
1212

1313
.. setting:: DATABASE-KMS-CREDENTIALS
1414

15+
.. _database-kms-credentials:
16+
1517
``KMS_CREDENTIALS``
1618
-------------------
1719

@@ -23,8 +25,8 @@ Vault, or GCP KMS) for encrypting and decrypting data using Queryable
2325
Encryption.
2426

2527
For example after :doc:`/howto/queryable-encryption`, to configure AWS KMS,
26-
Azure Key Vault, or GCP KMS credentials, you can set the ``KMS_CREDENTIALS``
27-
in your ``DATABASES`` settings as follows:
28+
Azure Key Vault, or GCP KMS credentials, you can set ``KMS_CREDENTIALS`` in
29+
your :setting:`django:DATABASES` settings as follows:
2830

2931
.. code-block:: python
3032

0 commit comments

Comments
 (0)