cloudstack/server/src/com/cloud
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
..
account Reformat all source code. Added checkstyle to check the source code 2013-11-20 07:26:53 -08:00
acl Error message exposes domain Id when deployVirtualMachine() is attempted on a shared network to which the user doesnot have access to. 2015-03-13 15:02:26 +05:30
agent/manager Fixed few coverity issues 2015-04-27 14:43:48 +02:00
alert CLOUDSTACK-8285: check and update IP capacity states based on allocation state 2015-02-25 16:47:40 +05:30
api CLOUDSTACK-8457: SAML auth plugin improvements for production usage 2015-06-29 12:31:51 +02:00
async Reformat all source code. Added checkstyle to check the source code 2013-11-20 07:26:53 -08:00
capacity CLOUDSTACK-8570:Exception in calculating reserved capacity for dynamic service offering 2015-06-19 09:30:33 +05:30
configuration CLOUDSTACK-8457: SAML auth plugin improvements for production usage 2015-06-29 12:31:51 +02:00
consoleproxy CLOUDSTACK-8301: Enable configuring local storage use for system VMs at zone level 2015-05-19 21:32:14 +05:30
dc Fixed some problems reported by FindBugs 2014-03-13 13:45:30 -07:00
deploy CLOUDSTACK-8301: Enable configuring local storage use for system VMs at zone level 2015-05-19 21:32:14 +05:30
event removed executable flags from java classes 2014-11-23 19:49:01 +01:00
ha server: Introduce Unknown Status to be used in AbstractInvestigatorImpl 2015-05-03 15:16:04 +02:00
hypervisor Fix findbugs warning in CloudZonesStartupProcessor.java Unnecessary boxing/unboxing of primitive value 2015-06-15 12:09:50 +03:00
metadata CLOUDSTACK-6987: Add support for storing metadata for snapshot policy and controlling policy using display flag 2014-06-24 14:07:39 -07:00
network Offer a getDurationInMillis() method in the Profiler utility class 2015-06-24 09:36:40 +02:00
projects Fix findbugs warning in ProjectManagerImpl.java Unnecessary boxing/unboxing of primitive value 2015-06-15 12:09:57 +03:00
resource Making possible to update KVM hosts password in the database via the API 2015-06-29 09:59:12 +02:00
resourcelimit CLOUDSTACK-5238: password checks, NPE fixes and minor fixes 2015-02-27 18:24:46 +05:30
server Add supported hypervisors to a list 2015-06-29 09:59:10 +02:00
servlet removed unused static main in ConsoleProxyPasswordBasedEncryptor 2015-04-17 12:07:04 +05:30
storage findbugs: repeated condition seems c&p error the tested states sugest that EXPUNGED should be the last one 2015-06-19 15:26:53 +03:00
tags CLOUDSTACK-7362: fix wrong uuid issue for resource tags 2014-08-18 16:17:36 +02:00
template findbugs Boolean return null in getter not in is-query 2015-06-28 12:41:44 +02:00
test findbugs: use a prepared statement as prepared statement 2015-06-19 23:26:00 +02:00
usage GetUsageRecordsCmd - NewInputFormat for START_DATE and END_DATE (with time; backward capabile) 2015-04-25 02:49:21 +02:00
user findbugs: removed redundant null check 2015-03-25 18:12:42 +01:00
uuididentity CLOUDSTACK-6785: changed async job param injectedjobid to customjobid and check for unique/uuid 2014-05-27 15:23:12 -06:00
vm AsyncJob reports 'Successful' even if RevertToVMSnapshot operation fails. 2015-06-19 15:48:21 +05:30