Fix build warnings to satisfy postgrest-docs-build

This commit is contained in:
Wolfgang Walther
2020-11-29 23:54:48 +01:00
committed by Wolfgang Walther
parent 634a0c70b7
commit 881170b9ff
3 changed files with 16 additions and 14 deletions
+13 -11
View File
@@ -208,20 +208,22 @@ To use Auth0, create `an application <https://auth0.com/docs/applications>`_ for
.. note::
Our code requires a database role in the JWT. To add it you need to save the database role in Auth0 `app metadata <https://auth0.com/docs/rules/metadata-in-rules>`_. Then, you will need to write `a rule <https://auth0.com/docs/rules>`_ that will extract the role from the user's app_metadata and set it as a `custom claim <https://auth0.com/docs/scopes/sample-use-cases-scopes-and-claims#add-custom-claims-to-a-token>`_ in the access token. Note that, you may use Auth0's `core authorization feature <https://auth0.com/docs/authorization/rbac>`_ for more complex use cases. Metadata solution is mentioned here for simplicity.
Our code requires a database role in the JWT. To add it you need to save the database role in Auth0 `app metadata <https://auth0.com/docs/rules/metadata-in-rules>`_. Then, you will need to write `a rule <https://auth0.com/docs/rules>`_ that will extract the role from the user's app_metadata and set it as a `custom claim <https://auth0.com/docs/scopes/sample-use-cases-scopes-and-claims#add-custom-claims-to-a-token>`_ in the access token. Note that, you may use Auth0's `core authorization feature <https://auth0.com/docs/authorization/rbac>`_ for more complex use cases. Metadata solution is mentioned here for simplicity.
.. code:: javascript
.. code:: javascript
function (user, context, callback) {
function (user, context, callback) {
// Follow the documentations at http://postgrest.org/en/v7.0.0/configuration.html#role-claim-key
// to set a custom role claim on PostgREST and use it as custom claim attribute in this rule
const myRoleClaim = 'https://myapp.com/role';
user.app_metadata = user.app_metadata || {};
context.accessToken[myRoleClaim] = user.app_metadata.role;
callback(null, user, context);
}
// Follow the documentations at
// http://postgrest.org/en/latest/configuration.html#role-claim-key
// to set a custom role claim on PostgREST
// and use it as custom claim attribute in this rule
const myRoleClaim = 'https://myapp.com/role';
user.app_metadata = user.app_metadata || {};
context.accessToken[myRoleClaim] = user.app_metadata.role;
callback(null, user, context);
}
.. _asym_keys:
+1 -1
View File
@@ -288,4 +288,4 @@ texinfo_documents = [
# -- Custom setup ---------------------------------------------------------
def setup(app):
app.add_stylesheet('css/custom.css')
app.add_css_file('css/custom.css')
+2 -2
View File
@@ -18,7 +18,7 @@ If you use **FreeBSD**, then you can install PostgREST from the `official ports
pkg install hs-postgrest
If you use **Arch Linux**, then you can install PostgREST from the `official repo <https://www.archlinux.org/packages/community/x86_64/postgrest>`_.
If you use **Arch Linux**, then you can install PostgREST from the `community repo <https://www.archlinux.org/packages/community/x86_64/postgrest>`_.
.. code:: bash
@@ -40,7 +40,7 @@ If you use Windows, you can install PostgREST using `Chocolatey <https://chocola
When a pre-built binary does not exist for your system you can :ref:`build the project from source <build_source>`.
Running
~~~~~~~
-------
If you downloaded PostgREST from the release page, first extract the compressed file to obtain the executable.