Merged HEAD-BUG-FIX (5.0/Cloud) to HEAD (5.0/Cloud)

84138: Merged FEATURE2 (5.0.0.FEATURE2) to HEAD-BUG-FIX (5.0/Cloud)
      83970: ACE-2268 : make ldaps (LDAP over SSL) configurable using ldap subsystem properties and not only JVM (system) properties (JAVA_OPTS)
      Implemented the LDAPS truststore configuration via subsystem's properties.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@84634 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Alan Davis
2014-09-18 17:26:44 +00:00
parent 2b5e64a359
commit 2b15a5b5ad
7 changed files with 382 additions and 5 deletions

View File

@@ -23,6 +23,7 @@ import junit.framework.Test;
import junit.framework.TestSuite;
import org.alfresco.repo.ownable.impl.OwnableServiceTest;
import org.alfresco.repo.security.authentication.AlfrescoSSLSocketFactoryTest;
import org.alfresco.repo.security.authentication.AuthenticationBootstrapTest;
import org.alfresco.repo.security.authentication.AuthenticationTest;
import org.alfresco.repo.security.authentication.AuthorizationTest;
@@ -81,7 +82,7 @@ public class SecurityTestSuite extends TestSuite
suite.addTestSuite(AuthorityBridgeTableAsynchronouslyRefreshedCacheTest.class);
suite.addTest(new JUnit4TestAdapter(HomeFolderProviderSynchronizerTest.class));
suite.addTest(new JUnit4TestAdapter(AlfrescoSSLSocketFactoryTest.class));
return suite;
}
}

View File

@@ -0,0 +1,57 @@
/*
* Copyright (C) 2005-2014 Alfresco Software Limited.
*
* This file is part of Alfresco
*
* Alfresco is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Alfresco is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Alfresco. If not, see <http://www.gnu.org/licenses/>.
*/
package org.alfresco.repo.security.authentication;
import org.alfresco.error.AlfrescoRuntimeException;
import org.junit.Test;
import java.security.KeyStore;
import static org.junit.Assert.fail;
/**
* SSL socket factory test
*
* @author alex.mukha
* @since 5.0
*/
public class AlfrescoSSLSocketFactoryTest
{
private static final String KEYSTORE_TYPE = "JCEKS";
@Test
public void testConfiguration() throws Exception
{
KeyStore ks = KeyStore.getInstance(KEYSTORE_TYPE);
// try to use the factory without initialization
try
{
AlfrescoSSLSocketFactory.getDefault();
fail("An AlfrescoRuntimeException should be thrown as the factory is not initialized.");
}
catch (AlfrescoRuntimeException are)
{
// Expected
}
// initialize and get an instance of AlfrescoSSLSocketFactory
AlfrescoSSLSocketFactory.initTrustedSSLSocketFactory(ks);
AlfrescoSSLSocketFactory.getDefault();
}
}