open callback with authentication

This commit is contained in:
Lincpay Tech
2025-12-03 18:14:12 +05:30
parent a210c86bcd
commit d88c624d50
2 changed files with 11 additions and 3 deletions
@@ -2,6 +2,7 @@ package com.billpaymentservice.bbps.config;
import java.util.Arrays;
import com.billpaymentservice.bbps.controller.AgentController;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpMethod;
@@ -18,13 +19,16 @@ import org.springframework.web.cors.UrlBasedCorsConfigurationSource;
@EnableWebSecurity
public class SecurityConfig {
private final AgentController agentController;
private final JwtAuthenticationEntryPoint jwtAuthenticationEntryPoint;
private final JwtFilter jwtFilter;
public SecurityConfig(JwtAuthenticationEntryPoint jwtAuthenticationEntryPoint, JwtFilter jwtFilter) {
public SecurityConfig(JwtAuthenticationEntryPoint jwtAuthenticationEntryPoint, JwtFilter jwtFilter, AgentController agentController) {
this.jwtAuthenticationEntryPoint = jwtAuthenticationEntryPoint;
this.jwtFilter = jwtFilter;
this.agentController = agentController;
}
@Bean
@@ -39,7 +43,10 @@ public class SecurityConfig {
"/swagger-resources/**",
"/webjars/**",
"/error")
.permitAll().requestMatchers(HttpMethod.OPTIONS, "/**").permitAll()
.permitAll()
.requestMatchers("/payment/callback/startPayment")
.permitAll().
requestMatchers(HttpMethod.OPTIONS, "/**").permitAll()
.anyRequest().authenticated())
.exceptionHandling(ex -> ex.authenticationEntryPoint(jwtAuthenticationEntryPoint))
.sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS));
@@ -6,13 +6,14 @@ import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.billpaymentservice.bbps.dto.ResponseModel;
import com.billpaymentservice.bbps.dto.request.PaymentStartUserRequest;
import com.billpaymentservice.bbps.dto.request.PollBackRequest;
import com.billpaymentservice.bbps.service.PollBackService;
@RequestMapping("/payment")
@RestController
public class PaymentPollBackController {