mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
115426 adavis: ACE-4520: Merged 5.1.N (5.1.1) to 5.1-MNT1 (5.1.0)
<< All the MNT-13871 commits at the end of phase 2 testing of 4.2.5 >>
111899: Merged 5.0.N (5.0.3) to 5.1.N (5.1.0) (PARTIAL MERGE)
111834: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3)
111589: Merged V4.1-BUG-FIX (4.1.11) to V4.2-BUG-FIX (4.2.6)
111531: MNT-13871: Count authorised users as those who've logged in, not total # of person objects
- Added small changes required for compilation of authorization module.,
111901: Merged 5.0.N (5.0.3) to 5.1.N (5.1.0) (PARTIAL MERGE)
111836: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3)
111765: Merged V4.2.5 (4.2.5) to V4.2-BUG-FIX (4.2.6)
111600: Merged V4.1-BUG-FIX (4.1.11) to PATCHES/V4.2.5 (4.2.5)
MNT-13871 : Count authorised users as those who've logged in, not total # of person objects
- Extra changes that are required to make authorization module build green.,
112553: Merged 5.0.N (5.0.3) to 5.1.N (5.1.1)
112540: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3)
112447: MNT-13871: Count authorised users as those who've logged in, not total # of person objects
- Added configuration required to compile authorised-users module.,
113101: Merged 5.0.N (5.0.3) to 5.1.N (5.1.1)
112930: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3)
112707 adavis: Merged V4.2.5 (4.2.5) to V4.2-BUG-FIX (4.2.6)
112677 dvaserin: MNT-14780 (MNT-13871): Licence Error message when in overage
- Place overage buffer information into License MBean and use it in admin license ftl.
112634 adavis: MNT-13871: Merged DEV (V4.2.5-MNT-13871-LATEST) to V4.2.5 (4.2.5)
111550: Merged DEV (4.1.11) to DEV (4.2.5)
MNT-13871 : Count authorised users as those who've logged in, not total # of person objects
- Merged all made changes in core alfresco projects as single commit to fresh dev branch forked from V4.1-BUG-FIX.
MNT-13871 : Count authorised users as those who've logged in, not total # of person objects
- added try/finally approach to reset show delete users flag to default value.,
111574: MNT-13871: Count authorised users as those who've logged in, not total # of person objects
- Added V4.2.5 specific changes.,
111582: MNT-13871: Count authorised users as those who've logged in, not total # of person objects
- Updated the jar to correspond with the latest changes in authorised-users/4.2,
111751: MNT-13871: Count authorised users as those who've logged in, not total # of person objects
- Removed unnecessary configuration.,
111752: Merged DEV (V4.1.11) to DEV (V4.2.5)
111632: MNT-13871 : Count authorised users as those who've logged in, not total # of person objects
- Fixed unit tests for build plan: https://bamboo.alfresco.com/bamboo/browse/DEV-ENT414-1,
111753: Merged DEV (4.1.11) to DEV (V4.2.5)
111719: MNT-13871 : Count authorised users as those who've logged in, not total # of person objects
- Updated authorization related icons with ones provided by Mark Howarth.
- Information message in Deauthorize Dialog was changed to the on provided by Mark Howarth.,
111754: MNT-13871 : Count authorised users as those who've logged in, not total # of person objects
- Updated to the latest authorised-users lib.,
111761: MNT-13871: Count authorised users as those who've logged in, not total # of person objects
- Fix for the SchemaReferenceFileTest.,
111800: MNT-13871: Count authorised users as those who've logged in, not total # of person objects
- Modified the test to create a tenant in a retrying transaction to solve the DataIntegrityViolationException.,
111801: Megred DEV (4.1.11) to DEV (4.2.5)
111795: MNT-13871 : Count authorised users as those who've logged in, not total # of person objects
- Updated Deleted column to display text instead of tick icon.
- Added name for actions column.,
111813: MNT-13871: Count authorised users as those who've logged in, not total # of person objects
- Updated to the latest authorisation jar to fix the Scema Reference test.,
112020: MNT-14775: De-authorisation pop-up has similar title to first line of text
- Remove the duplicated text from the pop-up body
- Updated link to point the 4.2 documentation,
112134: MNT-14763: [UserAuth] New entries are added in the authorization table for each different username case
- Update authorization jar,
112144: MNT-13871: Optimized strings in users.get.properties,
112184: MNT-14762 : [UserAuth]Users from the ALFRESCO_ADMINISTRATORS LDAP group are not pre-authorized
- Updated authorized-users jar with fix for ldap administrators pre-authorization.,
112196: MNT-14729 : [UserAuth] The column header for the Deauthorize and Reauthorize button should have a name
- Updated name for re/de-authorize actions column.,
112202: MNT-14763: [UserAuth] New entries are added in the authorization table for each different username case
- Add new authorization jar to fix null errors,
112203: MNT-14779: System behaviour when system set read only due to licence exception
- Force read-write transaction for LoginPost script.,
112225: MNT-14763: [UserAuth] New entries are added in the authorization table for each different username case
- Add new authorization jar after unit test fixing.,
112226: MNT-14740 : [UserAuth] The message for the failed re authorization is not displayed onIE
- Code for reloading page was wrapped with YAHOO.lang.later() function.,
112247: MNT-14747 : [UserAuth]The Autorization State isn't change when the user logs via FTP.
- Updated authorization jar with fix for kerberos unit test.,
112259: MNT-14776: Heading banner text when using all allowed authorised users.
- Changed the message.
- Updated the authorised-users jar.,
112269: MNT-13871: Count authorised users as those who've logged in, not total # of person objects
- Wrap methods that uses 'authenticationComponent.setCurrentUser' into RetryingTransaction for retrying on DataIntegrityViolationException.,
112285: MNT-14747 : [UserAuth]The Autorization State isn't change when the user logs via FTP.
- Updated version for authorized-users jar.,
112388: MNT-14809: [UserAuth] On a cluster setup after running the hourly job only one node goes into R/O mode
- Updated the authorised-users.jar,
112439: MNT-14815 : Wrong documentation link used in the deauthorize message window
- Corrected link to documentation.,
112445: MNT-14818 : [UserAuth] Missing quotation mark in the user reauthorization window message
- Corrected message for reauthorization dialog.,
112450: MNT-14802: [UserAuth] License warning message displayed for all the users
- Updated the authorised-users jar.,
112454: MNT-14780: Licence Error message when in overage
- Make license warn messages on admin console the same as banner warn messages.,
112471: MNT-14773 : Sort state not persisted after authorisation action
- Sorting/paging state is now persists in sessionStorage.,
112478: MNT-14773 : Sort state not persisted after authorisation action
- Corrected previous fix.,
112483: MNT-14814: [UserAuth] System goes into R/O mode after running the hourly job
- Updated the authorised-users jar to the latest version.,
112512: MNT-14833: [UserAuth] User cannot login on both nodes (cluster env.)
- Update authorization jar.,
112556: MNT-14787: [UserAuth] Login via NFS works when the license limit exceed
- Modified the exception handling of setCurrentUser method. Now all the exceptions are rethrown.,
112570: MNT-14838: Correct the Max Users string in the Admin Console License Screen
- Corrected the string, remove the incorrect translations from the bundle.,
112572: REVERSE MERGED <<code is not worth to implement>>
112471 : MNT-14773 : Sort state not persisted after authorisation action
- Sorting/paging state is now persists in sessionStorage.
112478 : MNT-14773 : Sort state not persisted after authorisation action
- Corrected previous fix. ,
112610: MNT-14837 : Report license overage to the log files on authorization/deauthorization of users
- Updated users authorization jar file.,
112627: MNT-14839: [UserAuth]Alfresco goes in read -only after reauthorize a user from LDAP ALFESCO_ADMINISTRATORS group
- Updated the authorised-users jar to the latest version.
Merged DEV (V5.0.2-MNT-13871) to 5.0.N (5.0.3)
111954: MNT-13871: Count authorised users as those who've logged in, not total # of person objects
- Removed context reference to authorization.,
112003: MNT-13871: Count authorised users as those who've logged in, not total # of person objects
- Added copying of sources and configuration from authorised-users to the output directory during build.,
112014: MNT-13871: Count authorised users as those who've logged in, not total # of person objects
- Modified the build configuration to unpack the resources to the test folders.,
112027: MNT-13871: Count authorised users as those who've logged in, not total # of person objects
- Added unpacking of authorisation resources to repoitory-crypto project.,
112067: MNT-13871: Count authorised users as those who've logged in, not total # of person objects
- Removed unpacking of resources, changed the context imports to point to authorization.,
112952: Merged DEV (V5.0.2-MNT-13871) to 5.0.N (5.0.3)
111887: MNT-13871: Count authorised users as those who've logged in, not total # of person objects
- Corrected the authorised-users version to correspond to 5.0.,
113060: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3)
113059 adavis: Merged V4.2.5 (4.2.5) to V4.2-BUG-FIX (4.2.6)
113058 adavis: MNT-13871: Count authorised users as those who've logged in, not total # of person objects
- Version dependency for alfresco-authorised-users moved to top level pom,
113103: Merged 5.0.N (5.0.3) to 5.1.N (5.1.1)
113036 adavis: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3)
113030 adavis: Merged V4.2.5 (4.2.5) to V4.2-BUG-FIX (4.2.6)
113019 amukha: MNT-14862 MNT-13871: [UserAuth] Login via FTP works when the license limit exceed
- Corrected the AlfrescoFtpAuthenticator to rollback teh transaction if an exception was thrown.,
113215: Merged 5.0.N (5.0.3) to 5.1.N (5.1.1)
113213 adavis: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3) (PARTIAL MERGE)
113209 adavis: Merged V4.2.5 (4.2.5) to V4.2-BUG-FIX (4.2.6)
113124: MNT-13871: MNT-14875: The table creation code for authorised-user (MNT-13871) need to be moved back into the main Alfresco code base
- Added the scripts to the main code base.
- Updated the authorised-users.jar,
113203: MNT-13871: MNT-14875: The table creation code for authorised-user (MNT-13871) need to be moved back into the main Alfresco code base
- Moved the patch to the main code.
- Updated the authorised-users.jar
113128: MNT-14867 (MNT-13871) : [UserAuth] License user limit exceeded by adding users to ALFRESCO_ADMINISTRATORS LDAP group
- Updated auhtorised-users jar.,,
113246: MNT-13871 : Count authorised users as those who've logged in, not total # of person objects
- Try to fix one of the two build errors on 5.1.N as a result of r113101,
113578: MNT-14901 MNT-13871: 4.2.5 User Auth code merged to 5.1.N caused 2 build failures
- Fixed the test SiteServiceImplTest.testGroupMembership ,
113647: MNT-14901 MNT-13871: 4.2.5 User Auth code merged to 5.1.N caused 2 build failures
- Fixed the test SiteServiceImplTest.testListSiteMemberships that failed after testGroupMembership was fixed, but didn't delete the created site.,
113935: MNT-13871: Merged 5.0.N (5.0.3) to 5.1.N (5.1.1) (PARTIAL MERGE)
113924 adavis: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3)
113914 adavis: Merged V4.2.5 (4.2.5) to V4.2-BUG-FIX (4.2.6)
113903 gbroadbent: GERMAN: Updated bundle based on EN-rev112938,
113936: MNT-13871: Merged 5.0.N (5.0.3) to 5.1.N (5.1.1) (PARTIAL MERGE)
113925 adavis: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3)
113915 adavis: Merged V4.2.5 (4.2.5) to V4.2-BUG-FIX (4.2.6)
113904 gbroadbent: SPANISH: Updated bundle based on EN-rev112938,
113937: MNT-13871: Merged 5.0.N (5.0.3) to 5.1.N (5.1.1) (PARTIAL MERGE)
113926 adavis: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3)
113916 adavis: Merged V4.2.5 (4.2.5) to V4.2-BUG-FIX (4.2.6)
113905 gbroadbent: FRENCH: Updated bundle based on EN-rev112938,
113939: MNT-13871: Merged 5.0.N (5.0.3) to 5.1.N (5.1.1) (PARTIAL MERGE)
113927 adavis: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3)
113917 adavis: Merged V4.2.5 (4.2.5) to V4.2-BUG-FIX (4.2.6)
113906 gbroadbent: ITALIAN: Updated bundle based on EN-rev112938,
113940: MNT-13871: Merged 5.0.N (5.0.3) to 5.1.N (5.1.1) (PARTIAL MERGE)
113928 adavis: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3)
113918 adavis: Merged V4.2.5 (4.2.5) to V4.2-BUG-FIX (4.2.6)
113907 gbroadbent: JAPANESE: Updated bundle based on EN-rev112938,
113941: MNT-13871: Merged 5.0.N (5.0.3) to 5.1.N (5.1.1) (PARTIAL MERGE)
113929 adavis: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3)
113919 adavis: Merged V4.2.5 (4.2.5) to V4.2-BUG-FIX (4.2.6)
113908 gbroadbent: NORWEGIAN Bokmal: Updated bundle based on EN-rev112938,
113942: MNT-13871: Merged 5.0.N (5.0.3) to 5.1.N (5.1.1) (PARTIAL MERGE)
113930 adavis: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3)
113920 adavis: Merged V4.2.5 (4.2.5) to V4.2-BUG-FIX (4.2.6)
113909 gbroadbent: DUCTH: Updated bundle based on EN-rev112938,
113943: MNT-13871: Merged 5.0.N (5.0.3) to 5.1.N (5.1.1) (PARTIAL MERGE)
113931 adavis: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3)
113921 adavis: Merged V4.2.5 (4.2.5) to V4.2-BUG-FIX (4.2.6)
113910 gbroadbent: BRAZILIAN PORTUGUESE: Updated bundle based on EN-rev112938,
113944: MNT-13871: Merged 5.0.N (5.0.3) to 5.1.N (5.1.1) (PARTIAL MERGE)
113932 adavis: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3)
113922 adavis: Merged V4.2.5 (4.2.5) to V4.2-BUG-FIX (4.2.6)
113911 gbroadbent: SIMPLIFIED Chinese: Updated bundle based on EN-rev112938,
113945: MNT-13871: Merged 5.0.N (5.0.3) to 5.1.N (5.1.1) (PARTIAL MERGE)
113933 adavis: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3)
113923 adavis: Merged V4.2.5 (4.2.5) to V4.2-BUG-FIX (4.2.6)
113912 gbroadbent: RUSSIAN: Updated bundle based on EN-rev112938,
114046: MNT-14901 MNT-13871: 4.2.5 User Auth code merged to 5.1.N caused 2 build failures
- Removed the hardcoded value in the test.,
114589: Merged 5.0.N (5.0.3) to 5.1.N (5.1.1)
114485 amorarasu: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3)
114335 amukha: Merged V4.1-BUG-FIX (4.1.11) to V4.2-BUG-FIX (4.2.6)
114334 amukha: MNT-14984 MNT-13871: Modification to the User Authentication Warning wording.
- Changed the warning message.,
114828: Merged 5.0.N (5.0.3) to 5.1.N (5.1.1)
114749 rmunteanu: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3)
114703 amorarasu: Merged V4.2.5 (4.2.5) to V4.2-BUG-FIX (4.2.6)
114574 gbroadbent: GERMAN: Updated file based on EN-rev114472. Fix for MNT-14984 MNT-13871,
114829: Merged 5.0.N (5.0.3) to 5.1.N (5.1.1)
114750 rmunteanu: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3)
114704 amorarasu: Merged V4.2.5 (4.2.5) to V4.2-BUG-FIX (4.2.6)
114575 gbroadbent: SPANISH: Updated file based on EN-rev114472. Fix for MNT-14984 MNT-13871,
114830: Merged 5.0.N (5.0.3) to 5.1.N (5.1.1)
114751 rmunteanu: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3)
114705 amorarasu: Merged V4.2.5 (4.2.5) to V4.2-BUG-FIX (4.2.6)
114576 gbroadbent: FRENCH: Updated file based on EN-rev114472. Fix for MNT-14984 MNT-13871,
114831: Merged 5.0.N (5.0.3) to 5.1.N (5.1.1)
114752 rmunteanu: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3)
114706 amorarasu: Merged V4.2.5 (4.2.5) to V4.2-BUG-FIX (4.2.6)
114577 gbroadbent: ITALIAN: Updated file based on EN-rev114472. Fix for MNT-14984 MNT-13871,
114832: Merged 5.0.N (5.0.3) to 5.1.N (5.1.1)
114753 rmunteanu: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3)
114708 amorarasu: Merged V4.2.5 (4.2.5) to V4.2-BUG-FIX (4.2.6)
114578 gbroadbent: JAPANESE: Updated file based on EN-rev114472. Fix for MNT-14984 MNT-13871,
114833: Merged 5.0.N (5.0.3) to 5.1.N (5.1.1)
114754 rmunteanu: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3)
114709 amorarasu: Merged V4.2.5 (4.2.5) to V4.2-BUG-FIX (4.2.6)
114579 gbroadbent: DUTCH: Updated file based on EN-rev114472. Fix for MNT-14984 MNT-13871,
114834: Merged 5.0.N (5.0.3) to 5.1.N (5.1.1)
114755 rmunteanu: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3)
114710 amorarasu: Merged V4.2.5 (4.2.5) to V4.2-BUG-FIX (4.2.6)
114580 gbroadbent: RUSSIAN: Updated file based on EN-rev114472. Fix for MNT-14984 MNT-13871,
114835: Merged 5.0.N (5.0.3) to 5.1.N (5.1.1)
114756 rmunteanu: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3)
114711 amorarasu: Merged V4.2.5 (4.2.5) to V4.2-BUG-FIX (4.2.6)
114593 gbroadbent: SIMP CHINESE: Updated file based on EN-rev114472. Fix for MNT-14984 MNT-13871,
114836: Merged 5.0.N (5.0.3) to 5.1.N (5.1.1)
114757 rmunteanu: Merged V4.2-BUG-FIX (4.2.6) to 5.0.N (5.0.3)
114712 amorarasu: Merged V4.2.5 (4.2.5) to V4.2-BUG-FIX (4.2.6)
114594 gbroadbent: NORWEGIAN Bokmal: Updated file based on EN-rev114472. Fix for MNT-14984 MNT-13871
git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@115664 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
410 lines
18 KiB
Java
410 lines
18 KiB
Java
/*
|
|
* Copyright (C) 2005-2012 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.remoteticket;
|
|
|
|
import org.alfresco.model.ContentModel;
|
|
import org.alfresco.repo.cache.SimpleCache;
|
|
import org.alfresco.repo.remoteconnector.LocalWebScriptConnectorServiceImpl;
|
|
import org.alfresco.repo.remotecredentials.PasswordCredentialsInfoImpl;
|
|
import org.alfresco.repo.security.authentication.AuthenticationException;
|
|
import org.alfresco.repo.security.authentication.AuthenticationUtil;
|
|
import org.alfresco.repo.transaction.RetryingTransactionHelper;
|
|
import org.alfresco.repo.web.scripts.BaseWebScriptTest;
|
|
import org.alfresco.service.cmr.remotecredentials.BaseCredentialsInfo;
|
|
import org.alfresco.service.cmr.remotecredentials.RemoteCredentialsService;
|
|
import org.alfresco.service.cmr.remoteticket.NoCredentialsFoundException;
|
|
import org.alfresco.service.cmr.remoteticket.NoSuchSystemException;
|
|
import org.alfresco.service.cmr.remoteticket.RemoteAlfrescoTicketInfo;
|
|
import org.alfresco.service.cmr.remoteticket.RemoteAlfrescoTicketService;
|
|
import org.alfresco.service.cmr.security.MutableAuthenticationService;
|
|
import org.alfresco.service.cmr.security.PersonService;
|
|
import org.alfresco.util.PropertyMap;
|
|
|
|
/**
|
|
* Tests for {@link RemoteAlfrescoTicketServiceImpl}, which work by
|
|
* looping back to the local repo. Because this tests talks to local
|
|
* webscripts, it needs to be run in the Remote API package
|
|
*
|
|
* TODO Test OAuth support, once added
|
|
*
|
|
* @author Nick Burch
|
|
* @since 4.0.2
|
|
*/
|
|
public class RemoteAlfrescoTicketServiceTest extends BaseWebScriptTest
|
|
{
|
|
private static final String TEST_REMOTE_SYSTEM_ID = "testingRemoteSystem";
|
|
private static final String INVALID_REMOTE_SYSTEM_ID = "testingInvalidRemoteSystem";
|
|
|
|
private MutableAuthenticationService authenticationService;
|
|
private RetryingTransactionHelper retryingTransactionHelper;
|
|
private PersonService personService;
|
|
|
|
private RemoteAlfrescoTicketService remoteAlfrescoTicketService;
|
|
private RemoteCredentialsService remoteCredentialsService;
|
|
private SimpleCache<String, String> ticketsCache;
|
|
|
|
private static final String USER_ONE = "UserOneSecondToo";
|
|
private static final String USER_TWO = "UserTwoSecondToo";
|
|
private static final String PASSWORD = "passwordTEST";
|
|
|
|
// General methods
|
|
|
|
@Override
|
|
@SuppressWarnings("unchecked")
|
|
protected void setUp() throws Exception
|
|
{
|
|
super.setUp();
|
|
|
|
this.retryingTransactionHelper = (RetryingTransactionHelper)getServer().getApplicationContext().getBean("retryingTransactionHelper");
|
|
this.authenticationService = (MutableAuthenticationService)getServer().getApplicationContext().getBean("AuthenticationService");
|
|
this.personService = (PersonService)getServer().getApplicationContext().getBean("PersonService");
|
|
|
|
this.remoteAlfrescoTicketService = (RemoteAlfrescoTicketService)getServer().getApplicationContext().getBean("remoteAlfrescoTicketService");
|
|
this.remoteCredentialsService = (RemoteCredentialsService)getServer().getApplicationContext().getBean("RemoteCredentialsService");
|
|
this.ticketsCache = (SimpleCache<String, String>)getServer().getApplicationContext().getBean("remoteAlfrescoTicketService.ticketsCache");
|
|
|
|
// Do the setup as admin
|
|
AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
|
|
|
|
// Add our local system as a remote service
|
|
remoteAlfrescoTicketService.registerRemoteSystem(TEST_REMOTE_SYSTEM_ID, "http://localhost:8080/alfresco/service/", null);
|
|
|
|
// Wire up the loop-back connector
|
|
((RemoteAlfrescoTicketServiceImpl)remoteAlfrescoTicketService).setRemoteConnectorService(
|
|
new LocalWebScriptConnectorServiceImpl(this));
|
|
|
|
// Ensure the invalid one isn't registered
|
|
remoteAlfrescoTicketService.registerRemoteSystem(INVALID_REMOTE_SYSTEM_ID, null, null);
|
|
|
|
// Create users
|
|
createUser(USER_ONE);
|
|
createUser(USER_TWO);
|
|
|
|
// Do tests as first user
|
|
AuthenticationUtil.setFullyAuthenticatedUser(USER_ONE);
|
|
}
|
|
|
|
@Override
|
|
protected void tearDown() throws Exception
|
|
{
|
|
super.tearDown();
|
|
|
|
// Admin user required to delete user
|
|
AuthenticationUtil.setAdminUserAsFullyAuthenticatedUser();
|
|
|
|
// Delete the users, which also zaps their credentials
|
|
if(personService.personExists(USER_ONE))
|
|
{
|
|
personService.deletePerson(USER_ONE);
|
|
}
|
|
if(this.authenticationService.authenticationExists(USER_ONE))
|
|
{
|
|
this.authenticationService.deleteAuthentication(USER_ONE);
|
|
}
|
|
|
|
if(personService.personExists(USER_TWO))
|
|
{
|
|
personService.deletePerson(USER_TWO);
|
|
}
|
|
if(this.authenticationService.authenticationExists(USER_TWO))
|
|
{
|
|
this.authenticationService.deleteAuthentication(USER_TWO);
|
|
}
|
|
|
|
// Unregister the system
|
|
remoteAlfrescoTicketService.registerRemoteSystem(TEST_REMOTE_SYSTEM_ID, null, null);
|
|
}
|
|
|
|
private void createUser(String userName)
|
|
{
|
|
// if user with given user name doesn't already exist then create user
|
|
if (this.authenticationService.authenticationExists(userName) == false)
|
|
{
|
|
// create user
|
|
this.authenticationService.createAuthentication(userName, PASSWORD.toCharArray());
|
|
|
|
// create person properties
|
|
PropertyMap personProps = new PropertyMap();
|
|
personProps.put(ContentModel.PROP_USERNAME, userName);
|
|
personProps.put(ContentModel.PROP_FIRSTNAME, "First");
|
|
personProps.put(ContentModel.PROP_LASTNAME, "Last");
|
|
personProps.put(ContentModel.PROP_EMAIL, "FirstName123.LastName123@email.com");
|
|
personProps.put(ContentModel.PROP_JOBTITLE, "JobTitle123");
|
|
personProps.put(ContentModel.PROP_JOBTITLE, "Organisation123");
|
|
|
|
// create person node for user
|
|
this.personService.createPerson(personProps);
|
|
}
|
|
}
|
|
|
|
/**
|
|
* Getting, storing and fetching credentials
|
|
*/
|
|
public void testGetStoreGetCredentials() throws Exception
|
|
{
|
|
// Run this test initially as the first user
|
|
AuthenticationUtil.setFullyAuthenticatedUser(USER_ONE);
|
|
|
|
|
|
// First, try an invalid system
|
|
try
|
|
{
|
|
remoteAlfrescoTicketService.getRemoteCredentials(INVALID_REMOTE_SYSTEM_ID);
|
|
fail("Shouldn't work for an invalid system");
|
|
}
|
|
catch(NoSuchSystemException e) {}
|
|
try
|
|
{
|
|
remoteAlfrescoTicketService.storeRemoteCredentials(INVALID_REMOTE_SYSTEM_ID, null, null);
|
|
fail("Shouldn't work for an invalid system");
|
|
}
|
|
catch(NoSuchSystemException e) {}
|
|
|
|
|
|
// Our user starts out without credentials
|
|
BaseCredentialsInfo credentials =
|
|
remoteAlfrescoTicketService.getRemoteCredentials(TEST_REMOTE_SYSTEM_ID);
|
|
assertEquals(null, credentials);
|
|
|
|
|
|
// Try to store some invalid credentials (real user, but password wrong)
|
|
try
|
|
{
|
|
remoteAlfrescoTicketService.storeRemoteCredentials(TEST_REMOTE_SYSTEM_ID, USER_ONE, "invalid");
|
|
fail("Credentials invalid, shouldn't be allowed");
|
|
}
|
|
catch (AuthenticationException e) {}
|
|
|
|
// And an invalid user
|
|
try
|
|
{
|
|
remoteAlfrescoTicketService.storeRemoteCredentials(TEST_REMOTE_SYSTEM_ID, "thisUSERdoesNOTexist", "invalid");
|
|
fail("Credentials invalid, shouldn't be allowed");
|
|
}
|
|
catch (AuthenticationException e) {}
|
|
|
|
|
|
// Still none there
|
|
credentials = remoteAlfrescoTicketService.getRemoteCredentials(TEST_REMOTE_SYSTEM_ID);
|
|
assertEquals(null, credentials);
|
|
|
|
|
|
// Store some valid ones
|
|
credentials = remoteAlfrescoTicketService.storeRemoteCredentials(TEST_REMOTE_SYSTEM_ID, USER_ONE, PASSWORD);
|
|
assertNotNull(credentials);
|
|
assertEquals(TEST_REMOTE_SYSTEM_ID, credentials.getRemoteSystemName());
|
|
assertEquals(USER_ONE, credentials.getRemoteUsername());
|
|
|
|
// Check we can find them
|
|
credentials = remoteAlfrescoTicketService.getRemoteCredentials(TEST_REMOTE_SYSTEM_ID);
|
|
assertNotNull(credentials);
|
|
assertEquals(TEST_REMOTE_SYSTEM_ID, credentials.getRemoteSystemName());
|
|
assertEquals(USER_ONE, credentials.getRemoteUsername());
|
|
|
|
|
|
// Store some different, valid credentials for the user
|
|
credentials = remoteAlfrescoTicketService.storeRemoteCredentials(TEST_REMOTE_SYSTEM_ID, USER_TWO, PASSWORD);
|
|
assertNotNull(credentials);
|
|
assertEquals(TEST_REMOTE_SYSTEM_ID, credentials.getRemoteSystemName());
|
|
assertEquals(USER_TWO, credentials.getRemoteUsername());
|
|
|
|
// Check we see the change
|
|
credentials = remoteAlfrescoTicketService.getRemoteCredentials(TEST_REMOTE_SYSTEM_ID);
|
|
assertNotNull(credentials);
|
|
assertEquals(TEST_REMOTE_SYSTEM_ID, credentials.getRemoteSystemName());
|
|
assertEquals(USER_TWO, credentials.getRemoteUsername());
|
|
|
|
|
|
// Switch to the other user, no credentials there
|
|
AuthenticationUtil.setFullyAuthenticatedUser(USER_TWO);
|
|
credentials = remoteAlfrescoTicketService.getRemoteCredentials(TEST_REMOTE_SYSTEM_ID);
|
|
assertEquals(null, credentials);
|
|
|
|
|
|
// Switch back, and delete
|
|
AuthenticationUtil.setFullyAuthenticatedUser(USER_ONE);
|
|
credentials = remoteAlfrescoTicketService.getRemoteCredentials(TEST_REMOTE_SYSTEM_ID);
|
|
assertNotNull(credentials);
|
|
|
|
boolean deleted = remoteAlfrescoTicketService.deleteRemoteCredentials(TEST_REMOTE_SYSTEM_ID);
|
|
assertEquals(true, deleted);
|
|
|
|
// Will have gone
|
|
credentials = remoteAlfrescoTicketService.getRemoteCredentials(TEST_REMOTE_SYSTEM_ID);
|
|
assertEquals(null, credentials);
|
|
|
|
// Double delete is reported
|
|
deleted = remoteAlfrescoTicketService.deleteRemoteCredentials(TEST_REMOTE_SYSTEM_ID);
|
|
assertEquals(false, deleted);
|
|
}
|
|
|
|
/**
|
|
* Getting cached and non-cached credentials
|
|
*/
|
|
public void testGetTicket() throws Exception
|
|
{
|
|
// Run this test initially as the first user
|
|
AuthenticationUtil.setFullyAuthenticatedUser(USER_ONE);
|
|
|
|
|
|
// First, try an invalid system
|
|
try
|
|
{
|
|
remoteAlfrescoTicketService.getAlfrescoTicket(INVALID_REMOTE_SYSTEM_ID);
|
|
fail("Shouldn't work for an invalid system");
|
|
}
|
|
catch(NoSuchSystemException e) {}
|
|
try
|
|
{
|
|
remoteAlfrescoTicketService.refetchAlfrescoTicket(INVALID_REMOTE_SYSTEM_ID);
|
|
fail("Shouldn't work for an invalid system");
|
|
}
|
|
catch(NoSuchSystemException e) {}
|
|
|
|
|
|
// Can't get or refresh if no credentials exist
|
|
try
|
|
{
|
|
remoteAlfrescoTicketService.getAlfrescoTicket(TEST_REMOTE_SYSTEM_ID);
|
|
fail("Shouldn't work when no credentials");
|
|
}
|
|
catch(NoCredentialsFoundException e) {}
|
|
try
|
|
{
|
|
remoteAlfrescoTicketService.refetchAlfrescoTicket(TEST_REMOTE_SYSTEM_ID);
|
|
fail("Shouldn't work when no credentials");
|
|
}
|
|
catch(NoCredentialsFoundException e) {}
|
|
|
|
|
|
// Have some stored
|
|
remoteAlfrescoTicketService.storeRemoteCredentials(TEST_REMOTE_SYSTEM_ID, USER_ONE, PASSWORD);
|
|
|
|
|
|
// A ticket will now exist
|
|
RemoteAlfrescoTicketInfo ticket = remoteAlfrescoTicketService.getAlfrescoTicket(TEST_REMOTE_SYSTEM_ID);
|
|
assertNotNull(ticket);
|
|
assertNotNull(ticket.getAsUrlParameters());
|
|
|
|
|
|
// Ask again, will get the same one
|
|
RemoteAlfrescoTicketInfo ticket2 = remoteAlfrescoTicketService.getAlfrescoTicket(TEST_REMOTE_SYSTEM_ID);
|
|
assertNotNull(ticket2);
|
|
assertEquals(ticket.getAsUrlParameters(), ticket2.getAsUrlParameters());
|
|
|
|
|
|
// Force a re-fetch, will get another
|
|
RemoteAlfrescoTicketInfo ticket3 = remoteAlfrescoTicketService.refetchAlfrescoTicket(TEST_REMOTE_SYSTEM_ID);
|
|
assertNotNull(ticket3);
|
|
assertNotSame(ticket.getAsUrlParameters(), ticket3.getAsUrlParameters());
|
|
|
|
// Ask for the ticket again, get the 2nd one again
|
|
RemoteAlfrescoTicketInfo ticket4 = remoteAlfrescoTicketService.getAlfrescoTicket(TEST_REMOTE_SYSTEM_ID);
|
|
assertNotNull(ticket4);
|
|
assertEquals(ticket3.getAsUrlParameters(), ticket4.getAsUrlParameters());
|
|
|
|
|
|
// Zap from the cache, will trigger another to be fetched
|
|
ticketsCache.clear();
|
|
|
|
RemoteAlfrescoTicketInfo ticket5 = remoteAlfrescoTicketService.getAlfrescoTicket(TEST_REMOTE_SYSTEM_ID);
|
|
assertNotNull(ticket5);
|
|
assertNotSame(ticket.getAsUrlParameters(), ticket5.getAsUrlParameters());
|
|
assertNotSame(ticket3.getAsUrlParameters(), ticket5.getAsUrlParameters());
|
|
|
|
|
|
// Change the password so it's no longer valid
|
|
PasswordCredentialsInfoImpl creds = (PasswordCredentialsInfoImpl)remoteCredentialsService.getPersonCredentials(TEST_REMOTE_SYSTEM_ID);
|
|
assertNotNull(creds);
|
|
creds.setRemotePassword("INVALID");
|
|
remoteCredentialsService.updateCredentials(creds);
|
|
|
|
// Currently will be marked as still working
|
|
assertEquals(true, creds.getLastAuthenticationSucceeded());
|
|
|
|
|
|
// Get will work, as ticket was previously cached
|
|
RemoteAlfrescoTicketInfo ticket6 = remoteAlfrescoTicketService.getAlfrescoTicket(TEST_REMOTE_SYSTEM_ID);
|
|
assertNotNull(ticket6);
|
|
assertEquals(ticket5.getAsUrlParameters(), ticket6.getAsUrlParameters());
|
|
|
|
// Re-fetch will fail with authentication error
|
|
try
|
|
{
|
|
remoteAlfrescoTicketService.refetchAlfrescoTicket(TEST_REMOTE_SYSTEM_ID);
|
|
fail("Shouldn't be able to refetch with wrong details");
|
|
}
|
|
catch(AuthenticationException e) {}
|
|
|
|
// Now a get will fail too, as the cache will be invalidated
|
|
try
|
|
{
|
|
remoteAlfrescoTicketService.getAlfrescoTicket(TEST_REMOTE_SYSTEM_ID);
|
|
fail("Shouldn't be able to get after refresh with wrong details");
|
|
}
|
|
catch(AuthenticationException e) {}
|
|
|
|
|
|
// If we check the credentials, will now be marked as failing
|
|
creds = (PasswordCredentialsInfoImpl)remoteCredentialsService.getPersonCredentials(TEST_REMOTE_SYSTEM_ID);
|
|
assertEquals(false, creds.getLastAuthenticationSucceeded());
|
|
|
|
|
|
// Change the password back to what it should be, and re-get
|
|
creds.setRemotePassword(PASSWORD);
|
|
remoteCredentialsService.updateCredentials(creds);
|
|
|
|
RemoteAlfrescoTicketInfo ticket7 = remoteAlfrescoTicketService.getAlfrescoTicket(TEST_REMOTE_SYSTEM_ID);
|
|
assertNotNull(ticket7);
|
|
assertNotSame(ticket.getAsUrlParameters(), ticket7.getAsUrlParameters());
|
|
assertNotSame(ticket3.getAsUrlParameters(), ticket7.getAsUrlParameters());
|
|
assertNotSame(ticket5.getAsUrlParameters(), ticket7.getAsUrlParameters());
|
|
|
|
// Should now be marked as working again
|
|
creds = (PasswordCredentialsInfoImpl)remoteCredentialsService.getPersonCredentials(TEST_REMOTE_SYSTEM_ID);
|
|
assertEquals(true, creds.getLastAuthenticationSucceeded());
|
|
|
|
|
|
// Check that failure can be marked in a read only transaction
|
|
creds.setRemotePassword("INVALID");
|
|
remoteCredentialsService.updateCredentials(creds);
|
|
|
|
retryingTransactionHelper.doInTransaction(new RetryingTransactionHelper.RetryingTransactionCallback<Void>()
|
|
{
|
|
public Void execute()
|
|
|
|
{
|
|
try
|
|
{
|
|
remoteAlfrescoTicketService.refetchAlfrescoTicket(TEST_REMOTE_SYSTEM_ID);
|
|
fail("Shouldn't be able to refetch with wrong details");
|
|
}
|
|
catch (AuthenticationException e)
|
|
{
|
|
}
|
|
return null;
|
|
}
|
|
}, false, true); // after MNT-13871, POST api/login webscript now requires read-write transaction
|
|
|
|
// Check it was still marked as invalid, despite a read only transaction
|
|
creds = (PasswordCredentialsInfoImpl)remoteCredentialsService.getPersonCredentials(TEST_REMOTE_SYSTEM_ID);
|
|
assertEquals(false, creds.getLastAuthenticationSucceeded());
|
|
}
|
|
}
|