Mar 22, 2018
0
Level 1
Expected CSRF token not found. Has your session expired?
hi guys , am facing this problem "Expected CSRF token not found. Has your session expired? " when i trying to login in my application.please help me to resolve above issue.belw is my security-context.xml
<!-- <security:intercept-url pattern="/api/v1/{customer_code}/security/authentication/login" access="permitAll" requires-channel="https"/>
<security:intercept-url pattern="/api/**" access="isAuthenticated()" requires-channel="https"/>
<security:port-mappings>
<security:port-mapping http="8080" https="8443"/>
</security:port-mappings> -->
<intercept-url pattern="/{customer_code}/security/authentication" access="permitAll" />
<intercept-url pattern="/{customer_code}/security/authentication/login" access="permitAll" />
<intercept-url pattern="/{customer_code}/security/ping" access="permitAll" />
<intercept-url pattern="/{customer_code}/registration/createRegistration" access="permitAll" />
<!-- make all unterface-url entries above this wildcard patterned url element given below -->
<intercept-url pattern="/**" access="isAuthenticated()" />
</security:http>
<global-method-security pre-post-annotations="enabled"/>
<beans:bean id="unauthorizedEntryPoint" class="com.s.core.security.secure.UnauthorizedEntryPoint" />
<beans:bean class="com.s.core.security.secure.AuthenticationTokenProcessingFilter" id="authenticationTokenProcessingFilter"/>
<!-- <security:authentication-manager alias="authenticationManager" />-->
<beans:bean id="passwordEncoder" class="org.springframework.security.crypto.password.StandardPasswordEncoder">
<beans:constructor-arg value="ThisIsASecretSoChangeMe" />
</beans:bean>
<authentication-manager id="authenticationManager">
<authentication-provider user-service-ref="userDao">
<password-encoder ref="passwordEncoder"></password-encoder>
</authentication-provider>
</authentication-manager>
<beans:bean id="userDao" class="com.s.core.security.service.internal.NHAuthenticationProviderImpl">
</beans:bean>
<beans:bean id="googleAuthenticatorConfigBuilder" class="com.warrenstrange.googleauth.GoogleAuthenticatorConfig.GoogleAuthenticatorConfigBuilder">
<!-- default values from API -->
<beans:property name="timeStepSizeInMillis" value="30000"/>
<beans:property name="windowSize" value="6"/>
<beans:property name="codeDigits" value="6"/>
<beans:property name="keyRepresentation">
<beans:value type="com.warrenstrange.googleauth.KeyRepresentation">BASE32</beans:value>
</beans:property>
</beans:bean>
<beans:bean id="googleAuthTemplete" class="com.s.caastotp.util.GoogleAuthTemplete">
<beans:constructor-arg ref="googleAuthenticatorConfigBuilder"/>
</beans:bean>
<beans:bean id="csrfTokenFilter" class="com.s.web.servlet.CsrfTokenFilter" />
<beans:bean id="csrfTokenRepository" class="org.springframework.security.web.csrf.HttpSessionCsrfTokenRepository" >
<beans:property name="headerName" value="X-CSRF-TOKEN" />
</beans:bean>
<beans:bean id="csrfRequestMatcher" class="com.s.web.servlet.CsrfSecurityRequestMatcher"> <beans:property name="paths"> <beans:list> <beans:value>http://www.onemap.sg/API/services.svc/basicSearch</beans:value> </beans:list> </beans:property> </beans:bean> </beans:beans>
Please or to participate in this conversation.