Commit Graph

27843 Commits

Author SHA1 Message Date
Rohit Yadav 107595a6a5 CLOUDSTACK-8457: SAML auth plugin improvements for production usage
* Move config options to SAML plugin
  This moves all configuration options from Config.java to SAML auth manager. This
  allows us to use the config framework.
* Make SAML2UserAuthenticator validate SAML token in httprequest
* Make logout API use ConfigKeys defined in saml auth manager
* Before doing SAML auth, cleanup local states and cookies
* Fix configurations in 4.5.1 to 4.5.2 upgrade path
* Fail if idp has no sso URL defined
* Add a default set of SAML SP cert for testing purposes
  Now to enable and use saml, one needs to do a deploydb-saml after doing a deploydb
* UI remembers login selections, IDP server

- CLOUDSTACK-8458:
    * On UI show dropdown list of discovered IdPs
    * Support SAML Federation, where there may be more than one IdP
        - New datastructure to hold metadata of SP or IdP
        - Recursive processing of IdP metadata
        - Fix login/logout APIs to get new interface and metadata data structure
        - Add org/contact information to metadata
        - Add new API: listIdps that returns list of all discovered IdPs
        - Refactor and cleanup code and tests

- CLOUDSTACK-8459:
    * Add HTTP-POST binding to SP metadata
    * Authn requests must use either HTTP POST/Artifact binding

- CLOUDSTACK-8461:
    * Use unspecified x509 cert as a fallback encryption/signing key
      In case a IDP's metadata does not clearly say if their certificates need to be
      used as signing or encryption and we don't find that, fallback to use the
      unspecified key itself.

- CLOUDSTACK-8462:
    * SAML Auth plugin should not do authorization
      This removes logic to create user if they don't exist. This strictly now
      assumes that users have been already created/imported/authorized by admins.
      As per SAML v2.0 spec section 4.1.2, the SP provider should create authn requests using
      either HTTP POST or HTTP Artifact binding to transfer the message through a
      user agent (browser in our case). The use of HTTP Redirect was one of the reasons
      why this plugin failed to work for some IdP servers that enforce this.
    * Add new User Source
      By reusing the source field, we can find if a user has been SAML enabled or not.
      The limitation is that, once say a user is imported by LDAP and then SAML
      enabled - they won't be able to use LDAP for authentication
    * UI should allow users to pass in domain they want to log into, though it is
      optional and needed only when a user has accounts across domains with same
      username and authorized IDP server
    * SAML users need to be authorized before they can authenticate
        - New column entity to track saml entity id for a user
        - Reusing source column to check if user is saml enabled or not
        - Add new source types, saml2 and saml2disabled
        - New table saml_token to solve the issue of multiple users across domains and
          to enforce security by tracking authn token and checking the samlresponse for
          the tokens
        - Implement API: authorizeSamlSso to enable/disable saml authentication for a
          user
        - Stubs to implement saml token flushing/expiry

- CLOUDSTACK-8463:
    * Use username attribute specified in global setting
      Use username attribute defined by admin from a global setting
      In case of encrypted assertion/attributes:
      - Decrypt them
      - Check signature if provided to check authenticity of message using IdP's
        public key and SP's private key
      - Loop through attributes to find the username

- CLOUDSTACK-8538:
    * Add new global config for SAML request sig algorithm

- CLOUDSTACK-8539:
    * Add metadata refresh timer task and token expiring
        - Fix domain path and save it to saml_tokens
        - Expire hour old saml tokens
        - Refresh metadata based on timer task
        - Fix unit tests

This closes #489

(cherry picked from commit 20ce346f3a)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

Conflicts:
	client/WEB-INF/classes/resources/messages_hu.properties
	plugins/hypervisors/xenserver/src/com/cloud/hypervisor/xenserver/resource/wrapper/xenbase/CitrixCheckHealthCommandWrapper.java
	plugins/user-authenticators/saml2/src/org/apache/cloudstack/api/command/SAML2LoginAPIAuthenticatorCmd.java
	ui/scripts/ui-custom/login.js
2015-06-29 12:31:51 +02:00
wilderrodrigues 527d6ee77b Making possible to update KVM hosts password in the database via the API
- Make sure the doUpdateHostPassword() method returns the result from the answer, not always true
   - Added the LibvirtUpdateHostPasswordCommandWrapper class, which will handle the changes in the KVM agent
     That's will be further implemented in the future. The command will avoid the agent to complain about Unsupported command
   - Added a test to make sure the current implementation of the comment works
     - If changes in the future, it will also require changes. In that way, we make sure nobody will break it

Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>

This closes #527
2015-06-29 09:59:12 +02:00
wilderrodrigues b8ab3cd3b3 Fix a bug in the doUpdateHostPassword() method
- 2 years ago a change in that method caused an issue when trying to update the hosts password:
    - they would be updated in the databse but not in the host it self, causing the hosts to disconnect after a management server resstart

Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>
2015-06-29 09:59:11 +02:00
wilderrodrigues 3367ecc71c Improving exception message
- Adding both ID and UUID of the host

Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>
2015-06-29 09:59:11 +02:00
wilderrodrigues 284e2d68e1 In case we cannot update the password of all hosts in a cluster, please stop and notify the user about the failure.
- The host id that failed to get updated will be informed in the error.

Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>
2015-06-29 09:59:11 +02:00
wilderrodrigues ea9db195ed Extracting local variable in order to make the code more readable.
Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>
2015-06-29 09:59:11 +02:00
wilderrodrigues 4690c3d844 Formatting the code of the AgentManagerImpl class
Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>
2015-06-29 09:59:10 +02:00
wilderrodrigues b6f12984c5 Add supported hypervisors to a list
- By doing so the check is simple and will require less effort when adding other hypervisors.

Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>
2015-06-29 09:59:10 +02:00
wilderrodrigues ba19d47ea0 Add method implementation to the mock class.
Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>
2015-06-29 09:59:10 +02:00
wilderrodrigues 03dd34039a Decouple the use of updateHostPassword
- The code was hard to maintain because updating a host or all the hosts in a cluster was handled in the same method
   - Created updateHost and updateCluster password in both ResourceManager and ManagementServer interfaces/classes
   - The chck for whihc method to use is done in the API level
   - Started adding the support for KVM host passwd update

No API changes are needed and it will be backwards compatible.

Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>
2015-06-29 09:59:10 +02:00
wilderrodrigues ac1b5e3705 Formatting the ResourceManagerImpl class
- Needed to be formatted before applying the changes

Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>
2015-06-29 09:59:09 +02:00
wilderrodrigues 305ce786e0 Formatting UpdateHostPasswordCmd class
- Needs to be formatted before applying other changes

Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>
2015-06-29 09:59:09 +02:00
wilderrodrigues 4e6fd0f17f Formatting the code of the ManagementService class
Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>
2015-06-29 09:59:09 +02:00
wilderrodrigues 4406e2c8ec Initial work on improveing host password update
- Formatting the code of ManagementServerImpl

Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>
2015-06-29 09:59:09 +02:00
SrikanteswaraRao Talluri 17ecd65331 CLOUDSTACK-8593: assign __testName if it is not getting set from test
This closes #537
Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>
2015-06-28 16:30:53 +05:30
Daan Hoogland edfe6f4d4f findbugs Boolean return null in getter not in is-query
Signed-off-by: Daan Hoogland <daan@onecht.net>

This closes #534
2015-06-28 12:41:44 +02:00
Daan Hoogland f5847147c0 findbugs: serializable fields
Signed-off-by: Daan Hoogland <daan@onecht.net>

This closes #533
2015-06-26 15:11:16 +02:00
Daan Hoogland 582687fb3f 4.4.4 to 4.5.2 upgrade
Conflicts:
	engine/schema/src/com/cloud/upgrade/DatabaseUpgradeChecker.java

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

This closes #529
2015-06-26 00:07:44 +02:00
Rafael da Fonseca bdd42a4157 Reduce script running time around 80% This resolves the performance penalty introduced by adding the midonet repo
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

This closes #530
2015-06-26 00:00:13 +02:00
Daan Hoogland c0bf00c568 findbugs encoding
fake message part to remove stale PR folowing
    This closes #33
2015-06-25 14:43:49 +02:00
Rafael da Fonseca 12d52401f7 Add git status output to debug git fetch failures
Signed-off-by: Daan Hoogland <daan@onecht.net>

This closes #523
2015-06-25 11:29:13 +02:00
wilderrodrigues 916aead9ab Using Profiler class, from the utils package, instead of System.currentTimeMillis()
Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>

This closes #525
2015-06-25 09:14:23 +02:00
wilderrodrigues 212ae884a1 Formatting class ClusterServiceServletImpl
- Splitting format commit from fix commit.

Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>
2015-06-25 09:14:23 +02:00
wilderrodrigues e4f7fb74ef Using Profiler class, from the utils package, instead of System.currentTimeMillis()
Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>

This closes #524
2015-06-25 09:13:46 +02:00
wilderrodrigues ea1f2eb049 Formatting class ClusterManagerImpl
- Splitting format commit from fix commit.

Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>
2015-06-25 09:13:46 +02:00
Rene Moser af902fd9d9 CLOUDSTACK-8578: implement state=present for listing only non-destroyed VMs
So the behavior before this fix can be used in a proper way.

Signed-off-by: Daan Hoogland <daan@onecht.net>

This closes #513
2015-06-24 20:21:33 +02:00
Daan Hoogland 55c1d9f3fa findbugs: fields of serializable made serializable
Signed-off-by: Daan Hoogland <daan@onecht.net>

This closes #522
2015-06-24 20:20:12 +02:00
Gaurav Aradhye f18c8f8d9b CLOUDSTACK-8582: Modifying tag for test cases which should not be run on simulator
Signed-off-by: Gaurav Aradhye <gaurav.aradhye@clogeny.com>
This closes #521
2015-06-24 16:52:24 +05:30
Rajani Karuturi a3fe76a4c4 Merge branch 'findbugs-MF' of https://github.com/DaanHoogland/cloudstack
This close #520
2015-06-24 16:29:34 +05:30
Daan Hoogland 8a8849354c findbugs: masking fields removed 2015-06-24 12:24:12 +02:00
wilderrodrigues 6c5bc96174 Merge branch 'test/pr518' 2015-06-24 09:54:07 +02:00
wilderrodrigues 4463881be4 Merge branch 'stop_vm' of https://github.com/nitt10prashant/cloudstack into test/pr518
This closes #518

Remark: I had to merge in the old-fashion way (not using the PR alias) due to a problem with the patch
2015-06-24 09:52:26 +02:00
pritisarap12 da72bb9aeb CLOUDSTACK-8574: Skip testcases for LXC if storagePool type is not RBD
Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>

This closes #488
2015-06-24 09:43:55 +02:00
pritisarap12 6f643fc486 CLOUDSTACK-8574: Skip testcases including data disk creation for LXC if storagePool type is not RBD
Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>
2015-06-24 09:43:55 +02:00
pritisarap12 7d70e4975e CLOUDSTACK-8576: Skip tests as snapshots and template are not supported on LXC
Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>

This closes #506
2015-06-24 09:40:08 +02:00
wilderrodrigues cbf5155f7b Renaming a couple of varibale to avoid misunderstanding
- All "micro" references have been replaced with "nano"

Signed-off-by: Daan Hoogland <daan@onecht.net>

This closes #516
2015-06-24 09:36:41 +02:00
wilderrodrigues 2f145378df Testing the elapsed time between 2 consecultive calls to System.nanoTime()
- 1 test was added

Signed-off-by: Daan Hoogland <daan@onecht.net>
2015-06-24 09:36:40 +02:00
wilderrodrigues 5557ad5588 Offer a getDurationInMillis() method in the Profiler utility class
- New implementation uses nanoseconds. Due to that, the places where the Profiler is used as a Monitor and/or
     a stopwatch will suffer with the difference in the return
   - Also added a getDuration(), which returns the time in nanoseconds in case someone wants to use it instead
   - Added an extra test to check if the getDuration() works fine with nanoseconds
   - Fixed the test that checks the time in milliseconds: I added an error margin to cover the test better

Signed-off-by: Daan Hoogland <daan@onecht.net>
2015-06-24 09:36:40 +02:00
Daan Hoogland e3daa10960 findbugs: final fields
Signed-off-by: Daan Hoogland <daan@onecht.net>

This closes #517
2015-06-24 09:29:56 +02:00
Gaurav Aradhye 230cf2eefa CLOUDSTACK-8582: Tagging test cases which should not be run on simulator accordingly
Signed-off-by: Gaurav Aradhye <gaurav.aradhye@clogeny.com>
This closes #519
2015-06-24 12:50:27 +05:30
nitt10prashant 4577af7206 CLOUDSTACK-8583 :fixing issue related to script test_stopped_vm 2015-06-24 12:31:23 +05:30
Rafael da Fonseca c599f63170 Extend wait before retry to states other than 'Starting'
Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>

This closes #514
2015-06-24 07:34:26 +02:00
nitt10prashant 77508c9d9a CLOUDSTACK-8577: fixing script testpath_disable_enable_zone 2015-06-24 10:50:20 +05:30
nitt10prashant 49451750a9 CLOUDSTACK-8577: fixing script testpath_disable_enable_zone 2015-06-24 10:50:19 +05:30
Daan Hoogland 8a99df77b6 findbugs volumeInfo is known to not be null
Signed-off-by: Daan Hoogland <daan@onecht.net>

This closes #515
2015-06-23 23:27:04 +02:00
Daan Hoogland e8984d16ed findbugs: move assert to a place where it still makes sense
Signed-off-by: Daan Hoogland <daan@onecht.net>
2015-06-23 23:27:03 +02:00
Rene Moser 82ecc1aa06 CLOUDSTACK-8578: fix listVirtualMachines does not return deleted machines when zone is specified
Signed-off-by: Daan Hoogland <daan.hoogland@gmail.com>

This closes #510
2015-06-23 14:53:08 +02:00
Sanjeev Neelarapu 66d51c91ea Made misc changes
Reviewed-By: Shweta
2015-06-23 17:47:19 +05:30
Gaurav Aradhye c841d6850e CLOUDSTACK-8579: Fix cleanup operation in few test cases
Signed-off-by: Gaurav Aradhye <gaurav.aradhye@clogeny.com>
This closes #511
2015-06-23 17:36:44 +05:30
wilderrodrigues f29bf1e85c Add unit tests to cover negative cases
- Cover when the profile is not started/stopped

Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>

This closes #509
2015-06-23 10:03:20 +02:00