Skip to content

Conversation

@vits-hugs
Copy link
Contributor

@vits-hugs vits-hugs commented May 14, 2025

Description

After setting a user to login using SAML, and then disabling the login by SAML for the user, he cannot access the account anymore, neither by saml nor by username and password. So this PRs adds and verification to let a user with SAML authentication disabled login with username and password.

Types of changes

  • Breaking change (fix or feature that would cause existing functionality to change)
  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Enhancement (improves an existing feature and functionality)
  • Cleanup (Code refactoring and cleanup, that may add test cases)
  • build/CI
  • test (unit or integration test code)

Bug Severity

  • BLOCKER
  • Critical
  • Major
  • Minor
  • Trivial

How Has This Been Tested?

To test, i followed this process:

  • With the config enable.login.saml.unathourized set to true:
    • Created a new user, and configured it to authenticate using SAML.
    • Login with SAML to test the new User.
    • Logout, and login with an Admin account.
    • Remove login with SAML of the user.
    • Login with the user using username and password.
  • *With the config enable.login.saml.unathourized set to false:
    • Created a new user, and configured it to authenticate using SAML.
    • Login with SAML to test the new User.
    • Logout, and login with an Admin account.
    • Remove login with SAML of the user.
    • Verify that i couldn't login with the user, with SAML and with username and password.

@vits-hugs vits-hugs changed the title Fix check Fix saml bug unable to login May 14, 2025
@vits-hugs
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@vits-hugs a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 13387

Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clgtm, maybe this should be a setting allowing the operator to enable the ‘bypass’ login or not. What do you think @vits-hugs ?

@codecov
Copy link

codecov bot commented May 15, 2025

Codecov Report

Attention: Patch coverage is 20.00000% with 4 lines in your changes missing coverage. Please review.

Project coverage is 15.18%. Comparing base (f0838cd) to head (a578d56).
Report is 29 commits behind head on 4.19.

Files with missing lines Patch % Lines
...g/apache/cloudstack/saml/SAML2AuthManagerImpl.java 0.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##               4.19   #10868    +/-   ##
==========================================
  Coverage     15.17%   15.18%            
- Complexity    11339    11360    +21     
==========================================
  Files          5414     5416     +2     
  Lines        475185   475894   +709     
  Branches      57991    58094   +103     
==========================================
+ Hits          72105    72246   +141     
- Misses       395018   395564   +546     
- Partials       8062     8084    +22     
Flag Coverage Δ
uitests 4.28% <ø> (-0.01%) ⬇️
unittests 15.90% <20.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@rohityadavcloud
Copy link
Member

Could be a security risk - perhaps wrap around a global setting. Some orgs may not want that?

@vits-hugs
Copy link
Contributor Author

I think that displaying warning would make more sense, after you disable the SAML login, since if an admin would want to unable a user to access the application, it should disable the account. What do you think about that?

@DaanHoogland
Copy link
Contributor

I think that displaying warning would make more sense, after you disable the SAML login, since if an admin would want to unable a user to access the application, it should disable the account. What do you think about that?

I think certain operators would want to be able to guarantee a user can only login via SSO. For some other operators your change makes sense. That is why we are asking to make the behaviour configurable.

@vits-hugs
Copy link
Contributor Author

@DaanHoogland @rohityadavcloud, As requested i added a configuration to make the behaviour configurable, please review the changes.

Copy link
Contributor

@DaanHoogland DaanHoogland left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clgtm

@sureshanaparti sureshanaparti added this to the 4.19.4 milestone Jun 5, 2025
@vits-hugs
Copy link
Contributor Author

@blueorangutan package

@blueorangutan
Copy link

@vits-hugs a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress.

@blueorangutan
Copy link

Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ debian ✔️ suse15. SL-JID 13639

@DaanHoogland
Copy link
Contributor

@blueorangutan test

@blueorangutan
Copy link

@DaanHoogland a [SL] Trillian-Jenkins test job (ol8 mgmt + kvm-ol8) has been kicked to run smoke tests

@blueorangutan
Copy link

[SF] Trillian test result (tid-13483)
Environment: kvm-ol8 (x2), Advanced Networking with Mgmt server ol8
Total time taken: 56764 seconds
Marvin logs: https://github.com/blueorangutan/acs-prs/releases/download/trillian/pr10868-t13483-kvm-ol8.zip
Smoke tests completed. 132 look OK, 1 have errors, 0 did not run
Only failed and skipped tests results shown below:

Test Result Time (s) Test File
test_01_secure_vm_migration Error 136.84 test_vm_life_cycle.py
test_01_secure_vm_migration Error 136.85 test_vm_life_cycle.py

@weizhouapache
Copy link
Member

I am not a SAML user, but I have two questions

  • if the SAML user is disabled, should we allow it to log into cloudstack ?
  • what the default value of new global settings should be ?

@weizhouapache weizhouapache modified the milestones: 4.19.4, 4.20.2 Sep 2, 2025
@weizhouapache weizhouapache modified the milestones: 4.20.2, 4.20.3 Sep 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants