Alfresco-Lock User Account on unsuccessfull attempts

cancel
Showing results for 
Search instead for 
Did you mean: 
sanjaybandhniya
Intermediate

Alfresco-Lock User Account on unsuccessfull attempts

I am exploring Lock user account on unsuccessfull attempts.

I found below properties and its working

authentication.protection.enabled=true
authentication.protection.limit=3
authentication.protection.periodSeconds=900

 

One more extra steps I want to do here is sending email to user on account lock.

I found java file(AuthenticationServiceImpl.java) where account lock logic is there but I am not getting idea how can I override that and write down my email send logic.

Any one have any idea about override?

4 Replies
angelborroy
Alfresco Employee

Re: Alfresco-Lock User Account on unsuccessfull attempts

You can override this method from AuthenticationServiceImpl:

https://github.com/Alfresco/alfresco-community-repo/blob/f2d858f911aeae635bd186dbc39fc729dc941013/re...

You may use following approach to override AuthenticationService Spring bean:

https://github.com/Acosix/alfresco-utility/blob/master/docs/Common-Spring-Processors.md

Hyland Developer Evangelist
sanjaybandhniya
Intermediate

Re: Alfresco-Lock User Account on unsuccessfull attempts

Thanks for answer.

I have a idea about class and method for my custom logic but not gettign idea how to override as I am not able to find bean.

 

Could you provide some basic idea to implement post processor for AuthenticationServiceImpl.

Trying below way but not getting idea for targetBeanName.

	<bean class="de.acosix.alfresco.utility.common.spring.ImplementationClassReplacingBeanFactoryPostProcessor">
	   <property name="targetBeanName" value="" />
	   <property name="originalClassName" value="org.alfresco.repo.security.authentication.AuthenticationServiceImpl" />
	   <property name="replacementClassName" value="org.alfresco.repo.security.authentication.MyAuthenticationServiceImpl" />
	   <property name="enabled" value="true" />
	</bean>	
angelborroy
Alfresco Employee

Re: Alfresco-Lock User Account on unsuccessfull attempts

sanjaybandhniya
Intermediate

Re: Alfresco-Lock User Account on unsuccessfull attempts

 

I configured below way but not working. Correct me if I am doing wrong way.

I am using alfresco sdk for customizations.

service-context.xml

	<bean class="de.acosix.alfresco.utility.common.spring.ImplementationClassReplacingBeanFactoryPostProcessor">
	    <!-- Spring placeholder can be used and will be transparently resolved from configured Spring resolvers + property sources -->
	    <property name="enabled" value="true" />
	    <property name="targetBeanName" value="authenticationService" />
	    <property name="originalClassName" value="org.alfresco.repo.security.authentication.AuthenticationServiceImpl" />
	    <property name="replacementClassName" value="org.alfresco.repo.security.authentication.CustomAuthenticationServiceImpl" />
	</bean>
	
public class CustomAuthenticationServiceImpl extends AuthenticationServiceImpl
{

}

I have included ImplementationClassReplacingBeanFactoryPostProcessor class and other classes where it has dependency.

 

Below I have tried to check and it is working whereas I did same thing for AuthenticationServiceImpl but not working.

I just created constructor to check, class is loading or not. MyInvitationServiceImpl constructor is loading during sdk start but AuthenticationServiceImpl constructor not loading.

 

<bean class="de.axelfaust.examples.beans.ImplementationClassReplacingBeanFactoryPostProcessor">
	   <property name="targetBeanName" value="invitationService" />
	   <property name="originalClassName" value="org.alfresco.repo.invitation.InvitationServiceImpl" />
	   <property name="replacementClassName" value="org.alfresco.repo.invitation.MyInvitationServiceImpl" />
	   <property name="enabled" value="true" />
	</bean>
	

 

It is not reaching to CustomAuthenticationServiceImpl

@angelborroy