Skip to content

Commit 5c14c1f

Browse files
[IMP] webservice_server_env: expose new OAuth2 options to server env
The webservice module gained new OAuth2 configuration fields (the token request method, the client authentication method, and the custom Authorization header name and value). These are now also manageable through server environment configuration files, like the other webservice fields.
1 parent d01133e commit 5c14c1f

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

webservice_server_env/models/webservice_backend.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ def _server_env_fields(self):
2929
"oauth2_authorization_url": {},
3030
"oauth2_token_url": {},
3131
"oauth2_audience": {},
32+
"oauth2_token_method": {},
33+
"oauth2_client_auth_method": {},
34+
"oauth2_client_auth_header": {},
35+
"oauth2_client_auth_value": {},
3236
}
3337
webservice_fields.update(base_fields)
3438
return webservice_fields

webservice_server_env/tests/test_oauth2.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,10 @@ def test_oauth2_flow_compute_with_ui(self):
104104
ws_form.api_key_header = "Test Api Key Header"
105105
if auth_type == "oauth2":
106106
ws_form.oauth2_flow = oauth2_flow
107+
# ``oauth2_client_auth_method`` is only shown (and drives the
108+
# visibility of the client id/secret) for the backend flow.
109+
if oauth2_flow == "backend_application":
110+
ws_form.oauth2_client_auth_method = "client_secret_basic"
107111
ws_form.oauth2_clientid = "Test Client ID"
108112
ws_form.oauth2_client_secret = "Test Client Secret"
109113
ws_form.oauth2_token_url = f"{url}oauth2/token"
@@ -122,6 +126,8 @@ def test_oauth2_flow_compute_with_ui(self):
122126
ws_form.auth_type = new_auth_type
123127
if new_auth_type == "oauth2":
124128
ws_form.oauth2_flow = oauth2_flow
129+
if oauth2_flow == "backend_application":
130+
ws_form.oauth2_client_auth_method = "client_secret_basic"
125131
ws_form.oauth2_clientid = "Test Client ID"
126132
ws_form.oauth2_client_secret = "Test Client Secret"
127133
ws_form.oauth2_token_url = f"{url}oauth2/token"

0 commit comments

Comments
 (0)