cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Unable to trigger custom B2BAcceleratorAuthenticationProvider

Former Member
0 Likes
608

Hello Experts,

For my requirement,i override the B2BAcceleratorAuthenticationProvider.But the MyCustomB2BAcceleratorAuthenticationProvider not trigging,its going to OOB class.

For this i did the following process:

1-->I extended my custom class from B2BAcceleratorAuthenticationProvider.

2-->In mycustomaddon extensioninfo.xml,am added and .

3-->Next I created mycutomaddon-spring-security-config.xml under the web/mycustomaddon/spring path,here i configured mycustom provider class like the following:

     <security:authentication-provider ref="myCustomB2BAcceleratorAuthenticationProvider"/>
 </security:authentication-manager> 



4-->And i specified mycutomaddon-spring-security-config.xml in mycustomaddon-->project.properties.

5-->finally i install the mycustomaddon on mystorefront.

6-->while staring the server i getting the following error logs:

ERROR [localhost-startStop-1] [ContextLoader] Context initialization failed INFO | jvm 1 | main | 2018/01/27 00:48:41.084 | org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'checkoutController': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'autoLoginStrategy' defined in ServletContext resource [/WEB-INF/config/spring-security-config.xml]: Cannot resolve reference to bean 'authenticationManager' while setting bean property 'authenticationManager'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'myCustomB2BAcceleratorAuthenticationProvider' defined in class path resource [mycustomaddon/web/spring/mycustomaddon-spring-security-config.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanInitializationException: Properties 'bruteForceAttackCounter', 'modelService', 'userDetailsService' and 'userService' are required for bean 'myCustomB2BAcceleratorAuthenticationProvider' INFO | jvm 1 | main | 2018/01/27 00:48:41.094 | at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:321) ~[spring-context-4.3.3.RELEASE.jar:4.3.3.RELEASE] INFO | jvm 1 | main | 2018/01/27 00:48:41.098 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1219) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE] INFO | jvm 1 | main | 2018/01/27 00:48:41.101 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE] INFO | jvm 1 | main | 2018/01/27 00:48:41.104 | at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482) ~[spring-beans-4.3.3.RELEASE.jar:4.3.3.RELEASE]

I am missing any configuration.Kindly suggest me.I am trying from last 4 days,please share your knowledge.Its help me lots..

Thank you...

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Likes

To override b2bAcceleratorAuthenticationProvider I had to extend it in my custom class.

I needed to set "abstractAcceleratorAuthenticationProvider" instead "b2bAcceleratorAuthenticationProvider" in my "spring-security-config.xml", to Override the B2BAcceleratorAuthenticationProvider, injecting all properties of "b2bAcceleratorAuthenticationProvider". Set the security:authentication-manager alias to authenticationManager, reffering the security:authentication-provider to my custom provider. Something like this:

 <bean id="customB2BAcceleratorAuthenticationProvider" parent="abstractAcceleratorAuthenticationProvider"
         class="br.com.custom.security.CustomB2BAcceleratorAuthenticationProvider">
          <property name="preAuthenticationChecks" ref="b2bRejectUserPreAuthenticationChecks"/>
          <property name="b2bUserGroupProvider" ref="b2bUserGroupProvider"/>
          <aop:scoped-proxy/>
     </bean>

Put in extensioninfo.xml the required extensions of b2bacceleratoraddon (addonsupport, acceleratorstorefrontcommons and b2bacceleratorfacades) and adding the spring security classpath in my project.properties, after the web-spring.xml additional config, separate by coma.

 customstorefront.additionalWebSpringConfigs.customb2bacceleratoradddon=classpath\:/customb2bacceleratoradddon/web/spring/customb2bacceleratoradddon-web-spring.xml,classpath\:/customb2bacceleratoradddon/web/spring/customb2bacceleratoraddon-spring-security-config.xml

I hope it's useful.

balsp
Explorer
0 Likes

Hi,

Did you extend the super class in your custom class? I think the problem here is on the dependency injection for the properties defined for the super class.

Thanks Bala