- Update deprecated methods in webSecurityCOnfig
- Remove 'deprecated' tag on methods that are to be removed in
EventsPublisher as they are still being used, methods with
deprecated tag (for removal) must not be used
Issue-ID: CPS-89
Signed-off-by: emaclee <lee.anjella.macabuhay@est.tech>
Change-Id: I104d4b3e362d22bb7fc020580de6cb4f390e54c9
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
+import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.provisioning.InMemoryUserDetailsManager;
import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.provisioning.InMemoryUserDetailsManager;
@SuppressWarnings("squid:S4502")
public SecurityFilterChain filterChain(final HttpSecurity http) throws Exception {
http
@SuppressWarnings("squid:S4502")
public SecurityFilterChain filterChain(final HttpSecurity http) throws Exception {
http
- .httpBasic()
- .and()
- .authorizeHttpRequests()
- .requestMatchers(permitUris).permitAll()
- .anyRequest().authenticated()
- .and()
- .csrf().disable();
+ .httpBasic(httpBasicCustomizer -> {})
+ .authorizeHttpRequests(authorizeHttpRequestsCustomizer -> {
+ authorizeHttpRequestsCustomizer.requestMatchers(permitUris).permitAll();
+ authorizeHttpRequestsCustomizer.anyRequest().authenticated();
+ })
+ .csrf(AbstractHttpConfigurer::disable);
return http.build();
}
/**
* In memory user authentication details.
*
return http.build();
}
/**
* In memory user authentication details.
*
- * @return in memory authetication
+ * @return in memory authentication
*/
@Bean
public InMemoryUserDetailsManager userDetailsService() {
*/
@Bean
public InMemoryUserDetailsManager userDetailsService() {
public class EventsPublisher<T> {
/**
public class EventsPublisher<T> {
/**
- * KafaTemplate for legacy (non-cloud) events.
- *
- * @deprecated Cloud events should be used. Will address soon as part of https://jira.onap.org/browse/CPS-1717
+ * KafkaTemplate for legacy (non-cloud) events.
+ * Note: Cloud events should be used. This will be addressed as part of https://jira.onap.org/browse/CPS-1717.
- @Deprecated(forRemoval = true)
private final KafkaTemplate<String, T> legacyKafkaEventTemplate;
private final KafkaTemplate<String, CloudEvent> cloudEventKafkaTemplate;
private final KafkaTemplate<String, T> legacyKafkaEventTemplate;
private final KafkaTemplate<String, CloudEvent> cloudEventKafkaTemplate;
/**
* Generic Event publisher.
/**
* Generic Event publisher.
+ * Note: Cloud events should be used. This will be addressed as part of https://jira.onap.org/browse/CPS-1717.
*
* @param topicName valid topic name
* @param eventKey message key
* @param event message payload
*
* @param topicName valid topic name
* @param eventKey message key
* @param event message payload
- * @deprecated Cloud events should be used. Will address soon as part of https://jira.onap.org/browse/CPS-1717
- @Deprecated(forRemoval = true)
public void publishEvent(final String topicName, final String eventKey, final T event) {
final CompletableFuture<SendResult<String, T>> eventFuture =
legacyKafkaEventTemplate.send(topicName, eventKey, event);
public void publishEvent(final String topicName, final String eventKey, final T event) {
final CompletableFuture<SendResult<String, T>> eventFuture =
legacyKafkaEventTemplate.send(topicName, eventKey, event);