mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-07 17:49:17 +00:00
Merged V2.1-A to HEAD
7710: Added spring configuration to administration web service to prevent management of user authentication details git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@12716 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -224,6 +224,9 @@
|
||||
<property name="querySessionCache">
|
||||
<ref bean="webServicesQuerySessionCache"/>
|
||||
</property>
|
||||
<property name="manageAuthenticationDetails">
|
||||
<value>true</value>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
|
@@ -65,6 +65,15 @@ public class AdministrationWebService extends AbstractWebService implements
|
||||
/** The person service */
|
||||
private PersonService personService = null;
|
||||
|
||||
/**
|
||||
* Indicates whether the user administration methods should manage the authentication
|
||||
* details, or just the person details.
|
||||
*
|
||||
* Set this to true if an 3rd party authentication implementation has been pluged into
|
||||
* the repository that manages authentication details.
|
||||
*/
|
||||
private boolean manageAuthenticationDetails = true;
|
||||
|
||||
/** The authentication service */
|
||||
private AuthenticationService authenticationService = null;
|
||||
|
||||
@@ -85,6 +94,17 @@ public class AdministrationWebService extends AbstractWebService implements
|
||||
AdministrationWebService.ignoredProperties.add(ContentModel.PROP_NODE_UUID);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the flag that indicates whether this service should manage user authentication details as
|
||||
* well as person details.
|
||||
*
|
||||
* @param manageAuthenticationDetails true if authentication details are managed, false otherwise
|
||||
*/
|
||||
public void setManageAuthenticationDetails(boolean manageAuthenticationDetails)
|
||||
{
|
||||
this.manageAuthenticationDetails = manageAuthenticationDetails;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the transaction service
|
||||
*
|
||||
@@ -389,9 +409,12 @@ public class AdministrationWebService extends AbstractWebService implements
|
||||
|
||||
int index = 0;
|
||||
for (NewUserDetails newUser : newUsers)
|
||||
{
|
||||
if (this.manageAuthenticationDetails == true)
|
||||
{
|
||||
// Create a new authentication
|
||||
this.authenticationService.createAuthentication(newUser.getUserName(), newUser.getPassword().toCharArray());
|
||||
}
|
||||
|
||||
// Create a new person
|
||||
Map<QName, Serializable> properties = new HashMap<QName, Serializable>(7);
|
||||
@@ -507,6 +530,8 @@ public class AdministrationWebService extends AbstractWebService implements
|
||||
* @param newPassword the new password
|
||||
*/
|
||||
private void changePasswordImpl(String userName, String oldPassword, String newPassword)
|
||||
{
|
||||
if (this.manageAuthenticationDetails == true)
|
||||
{
|
||||
// Update the authentication details
|
||||
if (this.authenticationService.getCurrentUserName().equals("admin") == true)
|
||||
@@ -518,6 +543,11 @@ public class AdministrationWebService extends AbstractWebService implements
|
||||
this.authenticationService.updateAuthentication(userName, oldPassword.toCharArray(), newPassword.toCharArray());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new RuntimeException("Web service has been configured so that user authenticaiton details are not managed.");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see org.alfresco.repo.webservice.administration.AdministrationServiceSoapPort#deleteUsers(java.lang.String[])
|
||||
@@ -556,8 +586,11 @@ public class AdministrationWebService extends AbstractWebService implements
|
||||
private void deleteUsersImpl(String[] userNames)
|
||||
{
|
||||
for (String userName : userNames)
|
||||
{
|
||||
if (this.manageAuthenticationDetails == true)
|
||||
{
|
||||
this.authenticationService.deleteAuthentication(userName);
|
||||
}
|
||||
this.personService.deletePerson(userName);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user