add SPIFFWORKFLOW_BACKEND_OPEN_ID_IS_AUTHORITY_FOR_USER_GROUPS and default to false

This commit is contained in:
burnettk 2023-09-08 12:54:32 -04:00
parent 948c633b2c
commit 4e47eadfea
3 changed files with 63 additions and 55 deletions

View File

@ -88,6 +88,10 @@ SPIFFWORKFLOW_BACKEND_OPEN_ID_TENANT_SPECIFIC_FIELDS = environ.get(
"SPIFFWORKFLOW_BACKEND_OPEN_ID_TENANT_SPECIFIC_FIELDS" "SPIFFWORKFLOW_BACKEND_OPEN_ID_TENANT_SPECIFIC_FIELDS"
) )
SPIFFWORKFLOW_BACKEND_OPEN_ID_IS_AUTHORITY_FOR_USER_GROUPS = (
environ.get("SPIFFWORKFLOW_BACKEND_OPEN_ID_IS_AUTHORITY_FOR_USER_GROUPS", default="false") == "true"
)
SPIFFWORKFLOW_BACKEND_AUTHENTICATION_DISABLED = ( SPIFFWORKFLOW_BACKEND_AUTHENTICATION_DISABLED = (
environ.get("SPIFFWORKFLOW_BACKEND_AUTHENTICATION_DISABLED", default="false") == "true" environ.get("SPIFFWORKFLOW_BACKEND_AUTHENTICATION_DISABLED", default="false") == "true"
) )

View File

@ -435,6 +435,8 @@ class AuthorizationService:
user_attributes["service_id"] = user_info["sub"] user_attributes["service_id"] = user_info["sub"]
desired_group_identifiers = None desired_group_identifiers = None
if current_app.config["SPIFFWORKFLOW_BACKEND_OPEN_ID_IS_AUTHORITY_FOR_USER_GROUPS"]:
if "groups" in user_info: if "groups" in user_info:
desired_group_identifiers = user_info["groups"] desired_group_identifiers = user_info["groups"]

View File

@ -29,6 +29,7 @@ class TestAuthentication(BaseTest):
client: FlaskClient, client: FlaskClient,
with_db_and_bpmn_file_cleanup: None, with_db_and_bpmn_file_cleanup: None,
) -> None: ) -> None:
with self.app_config_mock(app, "SPIFFWORKFLOW_BACKEND_OPEN_ID_IS_AUTHORITY_FOR_USER_GROUPS", True):
user = self.find_or_create_user("testing@e.com") user = self.find_or_create_user("testing@e.com")
user.email = "testing@e.com" user.email = "testing@e.com"
user.service = app.config["SPIFFWORKFLOW_BACKEND_OPEN_ID_SERVER_URL"] user.service = app.config["SPIFFWORKFLOW_BACKEND_OPEN_ID_SERVER_URL"]
@ -44,6 +45,7 @@ class TestAuthentication(BaseTest):
"exp": round(time.time()) + 1000, "exp": round(time.time()) + 1000,
} }
) )
response = None
response = client.post( response = client.post(
f"/v1.0/login_with_access_token?access_token={access_token}", f"/v1.0/login_with_access_token?access_token={access_token}",
) )