diff --git a/README.md b/README.md index 65f82a9d..27d031e9 100644 --- a/README.md +++ b/README.md @@ -173,9 +173,10 @@ make frontend-test make frontend-lint ``` -Backend tests can be run without docker with the env files -`env.d/development/common` and `env.d/development/common.test`. -`common.test` must overwrite some variables in `common`. +Backend tests can be run without docker. This is useful to configure PyCharm or VSCode to do it. +Removing docker for testing requires to overwrite some URL and port values that are different in and out of +Docker. `env.d/development/common` contains all variables, some of them having to be overwritten by those in +`env.d/development/common.test`. ### Demo content diff --git a/docs/env.md b/docs/env.md index cd31f46d..2dad89ec 100644 --- a/docs/env.md +++ b/docs/env.md @@ -108,6 +108,9 @@ These are the environment variables you can set for the `impress-backend` contai | OIDC_RP_SCOPES | Scopes requested for OIDC | openid email | | OIDC_RP_SIGN_ALGO | verification algorithm used OIDC tokens | RS256 | | OIDC_STORE_ID_TOKEN | Store OIDC token | true | +| OIDC_STORE_ACCESS_TOKEN | If True stores OIDC access token in session. | false | +| OIDC_STORE_REFRESH_TOKEN | If True stores OIDC refresh token in session. | false | +| OIDC_STORE_REFRESH_TOKEN_KEY | Key to encrypt refresh token stored in session, must be a valid Fernet key | | | OIDC_USERINFO_FULLNAME_FIELDS | OIDC token claims to create full name | ["first_name", "last_name"] | | OIDC_USERINFO_SHORTNAME_FIELD | OIDC token claims to create shortname | first_name | | OIDC_USE_NONCE | Use nonce for OIDC | true | @@ -117,8 +120,9 @@ These are the environment variables you can set for the `impress-backend` contai | SEARCH_INDEXER_CLASS | Class of the backend for document indexation & search | | | SEARCH_INDEXER_COUNTDOWN | Minimum debounce delay of indexation jobs (in seconds) | 1 | | SEARCH_INDEXER_QUERY_LIMIT | Maximum number of results expected from search endpoint | 50 | -| SEARCH_INDEXER_SECRET | Token for indexation queries | | -| SEARCH_INDEXER_URL | Find application endpoint for indexation | | +| SEARCH_URL | Find application endpoint for search queries | | +| SEARCH_INDEXER_SECRET | Token required for indexation queries | | +| INDEXING_URL | Find application endpoint for indexation | | | SENTRY_DSN | Sentry host | | | SESSION_COOKIE_AGE | duration of the cookie session | 60*60*12 | | SIGNUP_NEW_USER_TO_MARKETING_EMAIL | Register new user to the marketing onboarding. If True, see env LASUITE_MARKETING_* system | False | diff --git a/docs/search.md b/docs/search.md index 416f972b..cb077eae 100644 --- a/docs/search.md +++ b/docs/search.md @@ -1,8 +1,8 @@ -# Setup the Find search for Impress +# Setup Find search for Docs -This configuration will enable the fulltext search feature for Docs : -- Each save on **core.Document** or **core.DocumentAccess** will trigger the indexer -- The `api/v1.0/documents/search/` will work as a proxy with the Find API for fulltext search. +This configuration will enable Find searches: +- Each save on **core.Document** or **core.DocumentAccess** will trigger the indexing of the document into Find. +- The `api/v1.0/documents/search/` will be used as proxy for searching documents from Find indexes. ## Create an index service for Docs @@ -15,27 +15,27 @@ See [how-to-use-indexer.md](how-to-use-indexer.md) for details. ## Configure settings of Docs -Add those Django settings the Docs application to enable the feature. +Find uses a service provider authentication for indexing and a OIDC authentication for searching. + +Add those Django settings to the Docs application to enable the feature. ```shell SEARCH_INDEXER_CLASS="core.services.search_indexers.FindDocumentIndexer" + SEARCH_INDEXER_COUNTDOWN=10 # Debounce delay in seconds for the indexer calls. +SEARCH_INDEXER_QUERY_LIMIT=50 # Maximum number of results expected from the search endpoint -# The token from service "docs" of Find application (development). +INDEXING_URL="http://find:8000/api/v1.0/documents/index/" +SEARCH_URL="http://find:8000/api/v1.0/documents/search/" + +# Service provider authentication SEARCH_INDEXER_SECRET="find-api-key-for-docs-with-exactly-50-chars-length" -SEARCH_INDEXER_URL="http://find:8000/api/v1.0/documents/index/" -# Search endpoint. Uses the OIDC token for authentication -SEARCH_INDEXER_QUERY_URL="http://find:8000/api/v1.0/documents/search/" -# Maximum number of results expected from the search endpoint -SEARCH_INDEXER_QUERY_LIMIT=50 +# OIDC authentication +OIDC_STORE_ACCESS_TOKEN=True # Store the access token in the session +OIDC_STORE_REFRESH_TOKEN=True # Store the encrypted refresh token in the session +OIDC_STORE_REFRESH_TOKEN_KEY="" ``` -We also need to enable the **OIDC Token** refresh or the authentication will fail quickly. - -```shell -# Store OIDC tokens in the session -OIDC_STORE_ACCESS_TOKEN = True # Store the access token in the session -OIDC_STORE_REFRESH_TOKEN = True # Store the encrypted refresh token in the session -OIDC_STORE_REFRESH_TOKEN_KEY = "your-32-byte-encryption-key==" # Must be a valid Fernet key (32 url-safe base64-encoded bytes) -``` +`OIDC_STORE_REFRESH_TOKEN_KEY` must be a valid Fernet key (32 url-safe base64-encoded bytes). +To create one, use the `bin/fernetkey` command.