157 Commits

Author SHA1 Message Date
Rohit Yadav
c198dfdb7a Update pom and version usage to 4.5.1-SNAPSHOT
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-03-12 12:13:18 +05:30
Rohit Yadav
814e5574dc pbkdf2: fix encoding issue when converting byte[] to String
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-02-28 00:42:27 +05:30
Rohit Yadav
9533c54db6 CLOUDSTACK-5237: Add a default PBKDF2-SHA-256 based authenticator
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-02-27 15:50:09 +05:30
Rohit Yadav
1172867df0 CLOUDSTACK-8195: Don't break IdP, return metadata XML
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-02-03 16:59:09 +05:30
Rohit Yadav
876c78fe1b CLOUDSTACK-8191: SAML users should have their own accounts
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-02-02 19:56:25 +05:30
Rohit Yadav
6bec69844d CLOUDSTACK-8037: Require signed AuthnRequest, adds more security
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-01-14 02:40:00 +05:30
Rohit Yadav
23de431f96 CLOUDSTACK-8037: Fix attribute detection, tested to work with onelogin.com
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-01-12 19:40:05 +05:30
Rohit Yadav
4358714381 CLOUDSTACK-8035: Generate and store X509Cert and reuse this for SAML
The fix generates X509Certificate if missing from DB and uses that for eternity.
SAML SP metadata remains same since it's using the same X509 certificate and
it remains same after restarts. The certificate is serialized, base64 encoded
and stored in the keystore table under a specific name. For reading, it's
retrieved, base64 decoded and deserialized.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-01-12 16:47:31 +05:30
Rohit Yadav
734bd70173 CLOUDSTACK-8037: URL encode cookie values with UTF8 as per version 1
As per Version 1 cookies, certain characters are now allowed such as space,
colons etc but they should be url encoded using UTF8 encoding. The frontend
has a cookie value unboxing method that removes any double quotes that are added.

As per the doc http://download.oracle.com/javase/6/docs/api/java/net/URLEncoder.html
values are application/x-www-form-urlencoded and as per
http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4 whitespaces are encoded
as +, therefore '+' are replaced by %20 (whitespace).

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-01-12 14:02:36 +05:30
Rohit Yadav
b2b496288d CLOUDSTACK-8034: Hash user IDs for SAML authentication
The User table's UUID column is restricted to 40 chars only, since we don't
know how long the nameID/userID of a SAML authenticated user will be - the fix
hashes that user ID and takes a substring of length 40 chars. For hashing,
SHA256 is used which returns a 64 char length string.

- Fix tests, add test cases
- Improve checkSAMLUser method
- Use SHA256 one way hashing to create unique UUID for SAML users

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2015-01-12 13:33:57 +05:30
Rajani Karuturi
d969364daf Fixed coverity issue
CID 11461 (#1 of 1): DLS: Dead local store (FB.DLS_DEAD_LOCAL_STORE)
2014-11-06 09:38:22 +05:30
Rohit Yadav
cd52bed477 saml: Use camelCase api names for SAML login/logout apis
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
(cherry picked from commit 85c0bd68ae8a76c231ab402dd0311e3672155f71)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-10-31 00:32:29 +05:30
Rohit Yadav
fecc6b6e48 SAML2LoginAPIAuthenticatorCmd: Don't support HTTP artifact binding
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-09-12 16:47:40 +02:00
Rohit Yadav
394e6130e0 SAML2LoginAPIAuthenticatorCmd: add signature on redirect url
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-09-12 16:31:16 +02:00
Rohit Yadav
67f97df00f GetServiceProviderMetaDataCmd: in metadata use SP's own X509 certs
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-09-12 16:30:52 +02:00
Rohit Yadav
5e947e2b24 SAML2AuthManagerImpl: create or load keystore dao
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-09-12 16:28:02 +02:00
Rohit Yadav
aaa4b60b23 SAML2AuthManager: add new methods to the interface
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-09-12 16:27:11 +02:00
Rohit Yadav
f144081958 saml2: WIP X509 certificate auth stuff
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
(cherry picked from commit f7d409e0f4d2b6f56ec82ae339eff5f477e4a832)
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-09-12 14:31:21 +02:00
Rohit Yadav
aeec24b2ca SAMLMetaDataResponse: this should extend AuthenticationCmdResponse
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-09-12 13:58:39 +02:00
Rohit Yadav
8929d74519 SAML2UserAuthenticatorTest: Fix test, make sure encoded password length > 0
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-09-10 14:24:03 +02:00
Hugo Trippaers
dc3f0cbc63 Improve the handling of the findbug exclude files 2014-09-03 10:41:22 +02:00
Rohit Yadav
33a249e77a CLOUDSTACK-7455: Fix possible case for NPE
NPE can happen if Spring fails to inject api authenticator, so better check
and set list of commands if the authenticator is not null or returning null cmds

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-08-31 14:42:18 +02:00
Rohit Yadav
550762a0dc SAMLUtils: fix signature, refactor generateRandomX509Certificate
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-08-30 21:37:55 +02:00
Rohit Yadav
784288eaab SAML2AuthManagerImpl: let the component return true on start
- Return super.true() even if plugin is not enabled
- Return empty list when getCommands is called

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-08-30 14:32:54 +02:00
Rohit Yadav
81608afee1 SAML2LoginAPIAuthenticatorCmdTest: Add missing license
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-08-28 20:06:38 +02:00
Rohit Yadav
6eae9b8596 saml: disable plugin by default and don't initiate if not enabled
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-08-28 19:49:48 +02:00
Rohit Yadav
aa02e30e95 saml: fix tests and update method signature that generates random certs
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-08-28 19:45:27 +02:00
Rohit Yadav
0402f68b12 SAML2LogoutAPIAuthenticatorCmd: if session is null, redirect to login page
If session is null, probably logout (local) happened removing the name id and
session index which is needed for global logout. The limitation by design is that
local logout will void possibility of global logout. To globally logout, one
use the SLO api which would logout locally as well.

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-08-28 19:45:26 +02:00
Rohit Yadav
de4e74b2b4 saml: Add unit tests for saml plugin
- Fixes signatures on plugin manager for ease of testing
- Fixes authenticator
- Adds unit testing for getType and authenticate methods for all cmd classes
- Adds SAMLAuthenticator test

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-08-28 19:45:26 +02:00
Rohit Yadav
15fdc1744c SAML2LogoutAPIAuthenticatorCmd: check logout response and redirect to UI
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-08-28 19:45:26 +02:00
Rohit Yadav
8dc50927f9 saml: use SAML_RESPONSE from SAMLUtils
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-08-28 19:45:26 +02:00
Rohit Yadav
ad13d3d747 SAML2UserAuthenticator: check that request params has SAMLResponse
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-08-28 19:45:26 +02:00
Rohit Yadav
7ee4176c7a SAML2LogoutAPIAuthenticatorCmd: implement single log out
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-08-28 19:45:25 +02:00
Rohit Yadav
b1946e8c13 SAML2LoginAPIAuthenticatorCmd: store nameid and session index in user's session
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-08-28 19:45:25 +02:00
Rohit Yadav
b401828aef saml: use values from config for user account, domain and redirected url
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-08-28 19:45:25 +02:00
Rohit Yadav
a13da8f9e0 saml2: Add GetServiceProviderMetaDataCmd that returns SP metadata XML
This adds GetServiceProviderMetaDataCmd which returns SP metadata XML, since
this information should be public for IdPs to discover, we implement this as a
login/cmd api so this does not require any kind of authentication to GET this

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-08-28 19:45:24 +02:00
Rohit Yadav
7687b7311a saml: Implement logic to check response against X509 keys
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-08-28 19:45:24 +02:00
Rohit Yadav
47ccce85a1 api: add method to pass on api authenticators to cmd classes
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-08-28 19:45:24 +02:00
Rohit Yadav
06e909923a saml: Have the plugin use IDP metadata from URL, get values from Config
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-08-28 19:45:24 +02:00
Rohit Yadav
37961ebdd8 saml: Implement SAML2AuthManager interface
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-08-28 19:45:23 +02:00
Rohit Yadav
d45b303569 saml2: Fix plugin after refactoring
- Use opensaml version from root pom
- Add utils and api as explicit dependency
- Add org.apache.cloudstack.saml.SAML2AuthServiceImpl bean
- Fix imports in all source files and resource xmls
- Use methods available from SAMLUtils to encode/decode SAML request/response
- SAML logout api is not the global logout api

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-08-28 19:45:23 +02:00
Rohit Yadav
4422fdd9ad saml2: Implement SAML2AuthServiceImpl which is a PluggableAPIAuthenticator
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-08-28 19:45:23 +02:00
Rohit Yadav
68e094ebaf saml: move refactor files from server to api module
- Move interfaces and classes from server to api module
- This can be then used for pluggable api authenticators

Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-08-28 19:45:22 +02:00
Rajani Karuturi
14f3ad55ec Fixed CLOUDSTACK-7374: added PaginationControl while querying ldap users 2014-08-20 15:58:08 +05:30
Rohit Yadav
6a8f8317fd CLOUDSTACK-7361: Fix SAML2UserAuthenticator to not let every login credential
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-08-18 11:41:32 +02:00
Rohit Yadav
a6a63dd2d3 saml2: add opensaml as dependency
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-08-12 12:01:29 +02:00
Rohit Yadav
c35f704f21 saml2: add spring security saml2 extension 1.0.0.RELEASE
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-08-12 12:01:29 +02:00
Rohit Yadav
c4f200265b CLOUDSTACK-7083: Add SAML2 SSO plugin skeleton and stub
Signed-off-by: Rohit Yadav <rohit.yadav@shapeblue.com>
2014-08-12 12:01:28 +02:00
Rajani Karuturi
736ff5f8e5 Fixed CLOUDSTACK-7303 [LDAP] while importing ldap users, update the user info if it already exists in cloudstack 2014-08-11 17:54:31 +05:30
Rajani Karuturi
fca41bf527 Fixed bug: CLOUDSTACK-7214 added a config for ldap connection read timeout. 2014-08-01 16:32:45 +05:30