1310 Commits

Author SHA1 Message Date
wilderrodrigues
59d7bc3573 CLOUDSTACK-8660 - Formatting test and utility classes
Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>
2015-07-23 08:08:45 +02:00
Daan Hoogland
2982fcf615 CLOUDSTACK-8658: test default platform charset
Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>

This closes #612
2015-07-22 10:06:31 +02:00
Daan Hoogland
822ea9c787 CLOUDSTACK-8658: make initializer static instead of default
Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>
2015-07-22 10:06:31 +02:00
Wido den Hollander
178a9f555d CLOUDSTACK-8581: S3, make connection TTL and TCP KeepAlive configureable
Signed-off-by: Wido den Hollander <wido@widodh.nl>
2015-07-17 10:07:04 +02:00
Rohit Yadav
42940a8828 CLOUDSTACK-8622: Reinstate working sessions in browser
- Login is based on sessionkey HttpOnly Cookie
- ApiServlet does login verification using sessionKey from both the request cookies
  and the API parameters. In both cases, if either or both are passed they should
  match the sessionKey stored in the current session of the HttpRequest
- UI: it no longer needs to read or set sessionkey cookie
- UI: it no longer needs to return g_sessionKey value in the API requests, though
  to support a sso mechanism g_sessionKey is still passed in the API is not null
- Secure jsessionid cookie is set to be HttpOnly and Secure
- SAML login should also set HttpOnly cookie before redirecting to UI
- SAML: listIdps & getSPMetadata APIs are readonly now, won't log out a logged in user

Performed tests (login, saml login if applicable, page refreshes, opening
multiple tabs, logout) with following combinations:
- SAML disabled, normal auth as admin, domain-admin and user
- SAML enabled, normal auth as admin, domain-admin and user; and saml sso as
  admin, domain-admin and user

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

This closes #574
This closes #308
2015-07-10 17:25:07 +05:30
Daan Hoogland
bcc8182f2f findbugs: write to static from instance these are the trivial cases of ST_WRITE_TO_STATIC_FROM_INSTANCE_METHOD as reported by findbugs
Signed-off-by: Daan Hoogland <daan.hoogland@gmail.com>

This closes #539
2015-07-09 15:01:58 +02:00
Daan Hoogland
4ad178e4b1 rats: licenses added
Signed-off-by: Daan Hoogland <daan@onecht.net>

This closes #535
2015-07-07 13:48:20 +02:00
Daan Hoogland
d8ab5f3ab8 findbugs: equals unit tests
Signed-off-by: Daan Hoogland <daan@onecht.net>
2015-07-07 13:48:19 +02:00
Daan Hoogland
34629446b6 findbugs equals(obj) implementations go against the contract these are removed from the call into separate calls
Signed-off-by: Daan Hoogland <daan@onecht.net>
2015-07-07 13:48:19 +02:00
Likitha Shetty
13a98dd196 CLOUDSTACK-8601. VMFS storage added as local storage can be re-added as shared storage.
Fail addition of a VMFS shared storage pool in case it has already been added as local storage in CS.
2015-07-01 10:47:36 +05:30
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 20ce346f3acb794b08a51841bab2188d426bf7dc)
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
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
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
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
wilderrodrigues
78c802a539 Replace System.currentTimeMillis() by System.nanoTime()
- System.nanoTime() is the best way to measure elapsed time in Java.
   - It gives a resolution on the order of microseconds

The System.currentTimeMillis() is used when calculating absolut time.

Signed-off-by: wilderrodrigues <wrodrigues@schubergphilis.com>
2015-06-23 10:03:20 +02:00
Daan Hoogland
ba5b6b152e findbugs: deal with all the encoding issues in a unified way further getBytes() calls can getBytes(StringUtils.getPrefferedCharset()) instead
Signed-off-by: Daan Hoogland <daan.hoogland@gmail.com>

This closes #467

This closes #467
2015-06-18 12:13:26 +02:00
Rafael da Fonseca
3d1dde7a31 Remove accidental ~ character :)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

This closes #439
2015-06-15 12:10:08 +03:00
Rafael da Fonseca
a670f984d8 Fix findbugs warning HE_EQUALS_USE_HASHCODE in Ip4Address.java When overriding equals(), hashCode() must also be overriden do comply with the directive that equal objects must have equal hashcodes Without this implementation, usage of these kinds of objects in hashmaps for example, will be broken
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-06-15 12:10:07 +03:00
Rafael da Fonseca
a4659d009e Fix findbugs warning in Script.java Unnecessary boxing/unboxing of int value
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

This closes #436
2015-06-15 12:10:00 +03:00
Rafael da Fonseca
14f761a976 Fix findbugs warning in NetUtils.java Unnecessary boxing/unboxing of primitive value
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

This closes #435
2015-06-15 12:09:58 +03:00
jeff
db69c8e82b Allow PropertiesUtil to read from jar files.
PropertiesUtil has code for reading from jar files, but the
findConfigFile method will prevent it from ever returning a file in a
jar on the classpath since it always wants to have a "file:" URL and
use the File class.

This commit moves the jar file loading attempt from a catch block to
an else clause, executed if a config file:// URL could not be found.

Signed-off-by: Daan Hoogland <daan.hoogland@gmail.com>

This closes #358
2015-06-08 09:19:21 +02:00
Rafael da Fonseca
bec44bffb3 Upgrade Reflections to 0.9.9
Signed-off-by: Rajani Karuturi <rajanikaruturi@gmail.com>

This closes #333
2015-06-03 11:01:32 +05:30
Rohit Yadav
ca3ac68517 utils: add findCookie value by key helping method in HttpUtils
finds cookie value from an array of cookie by key name

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
(cherry picked from commit 78ea36d099371b9a59cbf1e3efd48b853ecc37ca)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-05-29 15:42:21 +02:00
wilderrodrigues
75463356fb CLOUDSTACK-8506
Removing the previous logic and adding a method to check if the CIDR is 31 bit prefixed
Adding tests for the new method

Signed-off-by: Daan Hoogland <daan.hoogland@gmail.com>

This closes #303
2015-05-26 12:10:00 +02:00
wilderrodrigues
a83f74d83e CLOUDSTACK-8506
- Changing the implementation of the NetUtils.ipRangesOverlap() a little bit in order to be compliant with RFC 3021
  - 2 unit tests added
  - ranges from 0 to 255 covered by the tests, which also test the negative cases.
2015-05-22 20:08:09 +02:00
wilderrodrigues
14863bbaff CLOUDSTACK-8506
- Added subnetUtils.setInclusiveHostCount(true) to NetUtils.isIpWithtInCidrRange() method. It makes the 31-bit prefixes work just fine
  - Added 3 unit tests to test valid and invalid ranges.
2015-05-22 18:17:16 +02:00
Wido den Hollander
43d20e67f8 graphite: Do not cache DNS names for Graphite host 2015-05-12 13:47:59 +02:00
Rohit Yadav
069aa4e5f3 CLOUDSTACK-8433: remove awsapi db usage and add upgrade cleanup path
- Removes awsapi db properties usage across codebase
- Removes references from spring xmls, test cases and TransactionLegacy
- Adds sql command to drop database cloudbridge in schema-451to460-cleanup.sql

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-05-06 15:22:04 +02:00
Rajani Karuturi
bd71fcb650 Fixed two coverity reported issues
Dereference after null check
Dm: Dubious method used

This closes #219
2015-05-01 16:08:26 +05:30
Daan Hoogland
9e3b825f91 findbugs: make default encoding explicit 2015-05-01 08:20:27 +02:00
Rajani Karuturi
d39b993512 Fixed a few findbugs issues after the merge 0b83559
HttpUploadServerHandler.java:142, DM_BOXED_PRIMITIVE_FOR_PARSING
NfsSecondaryStorageResource.java:2630, DM_BOXED_PRIMITIVE_FOR_PARSING
NfsSecondaryStorageResource.java:2775, DM_DEFAULT_ENCODING
EncryptionUtil.java:59, DM_DEFAULT_ENCODING
2015-04-30 13:56:44 +05:30
Koushik Das
1664c91214 Fixed RAT build issue 2015-04-29 16:24:00 +05:30
Rajani Karuturi
0b8355920e Merge branch 'volume-upload' into master
This closes #206
2015-04-29 11:12:53 +05:30
Rohit Yadav
48ef7e5f28 utils: improve timeout to 60s, define generics properly
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
(cherry picked from commit d2471df0be35c9af928c682c961ac0544b347159)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-04-13 15:47:45 +05:30
Rajani Karuturi
018023c1ef volume upload: added validation for file formats
merged TemplateUtils and ImageStoreUtil to a singe ImageStoreUtil
also added a unittest for ImageStoreUtil
2015-03-20 16:25:13 +05:30
Rohit Yadav
c8901a7990 utils: use a better extended implementation of SSLSocketFactory
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
(cherry picked from commit b4a5a32a7488ecd93f295670e7f641fc32198aa7)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-03-13 17:32:07 +05:30
Rajani Karuturi
debcbcc145 Fixed PMD NullDeref issues in S3Utils. 2015-03-05 11:58:24 +05:30
Rajani Karuturi
c5c1b1d462 Fixed checkstyle issues due to commit 0b6c540a203453580bb76a0d0a60be292fccfa0e 2015-03-04 16:21:53 +05:30
santhosh
0b6c540a20 listDirectory method updated to use ObjectListing.isTruncated().
Because buckets can contain a virtually unlimited number of keys, the
complete results of a list query can be extremely large. To manage large
result sets, Amazon S3 uses pagination to split them into multiple
responses.

Signed-off-by: Rajani Karuturi <rajanikaruturi@gmail.com>

This closes #25
2015-03-04 12:52:48 +05:30
Laszlo Hornyak
1f72548f57 CLOUDSTACK-4807: tests for NetUtils
Signed-off-by: Laszlo Hornyak <laszlo.hornyak@gmail.com>
2015-03-03 21:21:52 +01:00
Rohit Yadav
20bcb4b673 CLOUDSTACK-7063, CLOUDSTACK-7064: Add security headers on HTTP response
- Adds X-XSS-Protection header
- Adds X-Content-Type-Options header
- Fixes to use json content type defined from global settings
- Uses secure cookie if enabled in global settings

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
(cherry picked from commit b6b3494782d8bc1033941b802380ba1d5ebd464c)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-02-28 18:14:49 +05:30
Rohit Yadav
6df2fe7a8a CLOUDSTACK-8273: refactor baremetal user name to utils, restrict baremetal user
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
(cherry picked from commit cb08707addbffa12abc50aec9ad980059f23910c)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>

Conflicts:
	server/src/com/cloud/user/AccountManagerImpl.java
2015-02-26 17:47:01 +05:30
Rajani Karuturi
3814677977 volume upload: getUploadParamsForVolume url has IP address instead of hostname, SSL fails 2015-02-17 11:31:44 +05:30
Erik Weber
c31e8e7409 CLOUDSTACK-8215: Change Date calculation to Joda DateTime
(cherry picked from commit 03e07c41b5835e2a2007d132a0987cc371537ada)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-02-05 17:22:31 +05:30
Erik Weber
fdf4bd2ea2 SAML changing date calculation
Signed-off-by: Erik Weber <terbolous@gmail.com>
(cherry picked from commit b84c8889a35a8e56969d0f27f22cf197576f0728)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-02-05 17:22:20 +05:30
Rohit Yadav
d62d511f47 improve protocol enabling based on socket object type
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-02-05 15:48:21 +05:30
Rohit Yadav
008911d4b1 CLOUDSTACK-8195: Don't break IdP, return metadata XML
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
(cherry picked from commit 1172867df022358e8b5a2cd435dc1d8331fca8c9)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-02-03 17:05:29 +05:30