i have made an app in spring boot and there i used jwt security with bearer authentication but now i also want to use openai key which is also integrate with bearer token so i am not able to understand how to have two bearer token for a request as i already have a config file
@Configuration
@EnableWebSecurity
@EnableMethodSecurity
public class WebSecurityConfiguration {
private final JwtRequestFilter jwtRequestFilter;
@Autowired
public WebSecurityConfiguration(JwtRequestFilter jwtRequestFilter) {
this.jwtRequestFilter = jwtRequestFilter;
}
@Bean
public SecurityFilterChain securityFilterChain(HttpSecurity security) throws Exception {
return security.csrf().disable()
.authorizeHttpRequests()
.requestMatchers("/signup", "/login").permitAll()
.and()
.authorizeHttpRequests().requestMatchers("/api/**")
.authenticated()
.and()
.sessionManagement()
.sessionCreationPolicy(SessionCreationPolicy.STATELESS)
.and()
.addFilterBefore(jwtRequestFilter, UsernamePasswordAuthenticationFilter.class)
.build();
}
@Bean
public PasswordEncoder passwordEncoder() {
return new BCryptPasswordEncoder();
}
@Bean
public AuthenticationManager authenticationManager(AuthenticationConfiguration configuration) throws Exception {
return configuration.getAuthenticationManager();
}
}
it is my config file for jwt authorization now how i will integrate apenai key for bearer token
i want to know how to manage this situation where i need to have two bearer token one for jwt and another for openai.