on 09-09-2019 10:04 PM
Hi,
I have a requirement where i need to set employee lastLogin field in backoffice on successful login of backoffice users.
Did some digging into it and I am trying to to override ResetConfigurationAuthenticationSuccessHandler/BackofficeAuthenticationSuccessHandler class and its bean backofficeAuthenticationSuccessHandler in my custom extension and set the lastLogin field in the overridden success handler.
But I am getting the following error on server startup:
[Hybris Version:1811]
[BackofficeApplicationContext] Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.filterChains': Cannot resolve reference to bean 'org.springframework.security.web.DefaultSecurityFilterChain#4' while setting bean property 'sourceList' with key [4]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.DefaultSecurityFilterChain#4': Cannot resolve reference to bean 'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0' while setting constructor argument with key [4]; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0': Cannot resolve reference to bean 'backofficeAuthenticationSuccessHandler' while setting bean property 'authenticationSuccessHandler'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configurationAuthenticationSuccessHandler' defined in class path resource [custombackoffice-spring-security-config.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'com.hybris.backoffice.cockpitng.user.BackofficeCockpitUserService' to required type 'com.hybris.cockpitng.core.user.CockpitUserService' for property 'cockpitUserService'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'com.hybris.backoffice.cockpitng.user.BackofficeCockpitUserService' to required type 'com.hybris.cockpitng.core.user.CockpitUserService' for property 'cockpitUserService': no matching editors or conversion strategy found
Hi Amit,
The little modification to above solution worked for me , provide alias of "backofficeAuthenticationSuccessHandler" to "testSuccessHandler" in custombackoffice-backoffice-spring.xml file instead customizing the backoffice-spring-security.xml to change the successauthenticationhandler.
<alias name="testSuccessHandler" alias="backofficeAuthenticationSuccessHandler"/>
<beans:bean id="testSuccessHandler" parent="defaultBackofficeAuthenticationSuccessHandler">
<beans:property name="userService" ref="userService" />
<beans:property name="modelService" ref="modelService" />
</beans:bean>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Amit,
The little modification to above solution worked for me , provide alias of "backofficeAuthenticationSuccessHandler" to "testSuccessHandler" in custombackoffice-backoffice-spring.xml file instead customizing the backoffice-spring-security.xml to change the successauthenticationhandler.
<alias name="testSuccessHandler" alias="backofficeAuthenticationSuccessHandler"/>
<beans:bean id="testSuccessHandler" parent="defaultBackofficeAuthenticationSuccessHandler">
<beans:property name="userService" ref="userService" />
<beans:property name="modelService" ref="modelService" />
</beans:bean>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.