Skip to content

Commit add5c72

Browse files
committed
[DOP-26758] Disable session middleware by default
1 parent 4822372 commit add5c72

8 files changed

Lines changed: 42 additions & 9 deletions

File tree

config.docker.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ server:
3737
debug: true # !!! NEVER USE ON PRODUCTION !!!
3838

3939
session:
40+
enabled: true
4041
secret_key: generate_some_random_string
4142
max_age: 86400
4243

config.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ server:
3737
debug: true # !!! NEVER USE ON PRODUCTION !!!
3838

3939
session:
40+
enabled: true
4041
secret_key: generate_some_random_string
4142
max_age: 86400
4243

docs/reference/scheduler/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ With docker
3434
.. dropdown:: ``config.yml``
3535

3636
.. literalinclude:: ../../../config.yml
37-
:emphasize-lines: 1-5,53-54
37+
:emphasize-lines: 1-5,54-55
3838

3939
Without docker
4040
^^^^^^^^^^^^^^

docs/reference/server/auth/keycloak/index.rst

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,8 @@ Basic configuration
8383

8484

8585
OAuth2 Gateway Provider
86-
-----------
86+
-----------------------
87+
8788
In case of using an OAuth2 Gateway, all API requests will come with an Authorization: Bearer header. For this scenario, Syncmaster provides an alternative authentication provider called OAuth2GatewayProvider. This provider works as follows:
8889

8990
- It extracts the access token from the Authorization header.
@@ -103,4 +104,4 @@ OAuth2GatewayProvider uses the same configuration models as KeycloakAuthProvider
103104
:caption: Keycloak
104105
:hidden:
105106

106-
local_installation
107+
local_installation

docs/reference/server/auth/keycloak/local_installation.rst

Lines changed: 33 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ Set URI to redirect from Keycloak login page for exchanging the code for an acce
8585
8686
auth:
8787
keycloak:
88-
# set here SyncMaster hostname/domain
88+
# Set here URL of SyncMaster UI page handling callback redirects
8989
redirect_uri: http://localhost:3000/auth/callback
9090
# ...
9191
@@ -108,6 +108,29 @@ Now go to **Credentials** tab and generate a client secret:
108108
109109
Now you can use create users in this realm, check `Keycloak documentation <https://www.keycloak.org/docs/latest/server_admin/#assembly-managing-users_server_administration_guide>`_ on how to manage users creation.
110110

111+
Enable session middleware
112+
~~~~~~~~~~~~~~~~~~~~~~~~~
113+
114+
Enable :ref:`server-configuration-session <SesionMiddleware>`, and generate random string to use as secret key for cookie encryption.
115+
116+
.. code-block:: yaml
117+
:caption: config.yml
118+
119+
server:
120+
session:
121+
enabled: true
122+
secret_key: secret_key_for_session_cookie
123+
124+
Replace login page with Keycloak redirect button
125+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
126+
127+
.. code-block:: yaml
128+
:caption: config.yml
129+
130+
ui:
131+
# required by KeycloakAuthProvider
132+
auth_provider: keycloakAuth
133+
111134
Final configuration
112135
~~~~~~~~~~~~~~~~~~~
113136

@@ -121,15 +144,22 @@ After this you can use ``KeycloakAuthProvider`` in your application:
121144
keycloak:
122145
# Keycloak URL accessible from both SyncMaster server and from browser
123146
server_url: http://keycloak:8080
124-
# set here SyncMaster hostname/domain
147+
# Set here URL of SyncMaster UI page handling callback redirects
125148
redirect_uri: http://localhost:3000/auth/callback
126149
realm_name: fastapi_realm
127150
client_id: fastapi_client
128151
client_secret: 6x6gn8uJdWSBmP8FqbNRSoGdvaoaFeez
129152
scope: email
130153
verify_ssl: false
131154
155+
server:
156+
session:
157+
# required by KeycloakAuthProvider
158+
enabled: true
159+
secret_key: secret_key_for_session_cookie
160+
132161
ui:
162+
# required by KeycloakAuthProvider
133163
auth_provider: keycloakAuth
134-
# set here SyncMaster hostname/domain
164+
# SyncMaster API URL, accessible from browser
135165
api_browser_url: http://localhost:8000

docs/reference/server/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ With docker
3333
.. dropdown:: ``config.yml``
3434

3535
.. literalinclude:: ../../../config.yml
36-
:emphasize-lines: 7-27, 36-49, 70-71
36+
:emphasize-lines: 7-27, 36-50, 71-72
3737

3838
* After server is started and ready, open http://localhost:8000/docs.
3939

docs/reference/worker/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ With docker
4343
.. dropdown:: ``config.yml``
4444

4545
.. literalinclude:: ../../../config.yml
46-
:emphasize-lines: 1-10,57-67
46+
:emphasize-lines: 1-10,58-68
4747

4848
Without docker
4949
^^^^^^^^^^^^^^

syncmaster/server/settings/server/session.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ class SessionSettings(BaseModel):
6262
"""
6363

6464
enabled: bool = Field(
65-
default=True,
65+
default=False,
6666
description="Set to ``True`` to enable SessionMiddleware",
6767
)
6868
secret_key: SecretStr | None = Field(

0 commit comments

Comments
 (0)