Skip to content

Commit

Permalink
catch exception when USE_SAML2 is True but configuration not completed (
Browse files Browse the repository at this point in the history
#2214)

* catch exception

* improved

* Update mslib/mscolab/server.py

Co-authored-by: Matthias Riße <[email protected]>

---------

Co-authored-by: Matthias Riße <[email protected]>
  • Loading branch information
ReimarBauer and matrss authored Feb 16, 2024
1 parent 4e54830 commit 6df4172
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions mslib/mscolab/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -833,10 +833,13 @@ def acs_post_handler():

# Implementation for handling configured SAML assertion consumer endpoints
for idp_config in setup_saml2_backend.CONFIGURED_IDPS:
for assertion_consumer_endpoint in idp_config['idp_data']['assertion_consumer_endpoints']:
# Dynamically add the route for the current endpoint
APP.add_url_rule(f'/{assertion_consumer_endpoint}/', assertion_consumer_endpoint,
create_acs_post_handler(idp_config), methods=['POST'])
try:
for assertion_consumer_endpoint in idp_config['idp_data']['assertion_consumer_endpoints']:
# Dynamically add the route for the current endpoint
APP.add_url_rule(f'/{assertion_consumer_endpoint}/', assertion_consumer_endpoint,
create_acs_post_handler(idp_config), methods=['POST'])
except (NameError, AttributeError, KeyError) as ex:
logging.warning("USE_SAML2 is %s, Failure is: %s", mscolab_settings.USE_SAML2, ex)

@APP.route('/idp_login_auth/', methods=['POST'])
def idp_login_auth():
Expand Down

0 comments on commit 6df4172

Please sign in to comment.