diff --git a/src/main/java/com/billpaymentservice/bbps/config/SecurityConfig.java b/src/main/java/com/billpaymentservice/bbps/config/SecurityConfig.java index 15f9c4b..7e9c75a 100644 --- a/src/main/java/com/billpaymentservice/bbps/config/SecurityConfig.java +++ b/src/main/java/com/billpaymentservice/bbps/config/SecurityConfig.java @@ -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)); diff --git a/src/main/java/com/billpaymentservice/bbps/controller/PaymentPollBackController.java b/src/main/java/com/billpaymentservice/bbps/controller/PaymentPollBackController.java index bfc1828..8c5b7b8 100644 --- a/src/main/java/com/billpaymentservice/bbps/controller/PaymentPollBackController.java +++ b/src/main/java/com/billpaymentservice/bbps/controller/PaymentPollBackController.java @@ -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 {