CPD Results

The following document contains the results of PMD's CPD 6.29.0.

Duplications

File Line
org/bremersee/web/reactive/CorsAutoConfiguration.java 42
org/bremersee/web/servlet/CorsAutoConfiguration.java 42
public class CorsAutoConfiguration implements WebFluxConfigurer {

  private final CorsProperties properties;

  /**
   * Instantiates a new cors auto configuration.
   *
   * @param properties the cors properties
   */
  public CorsAutoConfiguration(CorsProperties properties) {
    this.properties = properties;
  }

  /**
   * Init.
   */
  @EventListener(ApplicationReadyEvent.class)
  public void init() {
    log.info("\n"
            + "*********************************************************************************\n"
            + "* {}\n"
            + "*********************************************************************************\n"
            + "* properties = {}\n"
            + "*********************************************************************************",
        ClassUtils.getUserClass(getClass()).getSimpleName(), properties);
  }

  @SuppressWarnings("DuplicatedCode")
  @Override
  public void addCorsMappings(@NonNull CorsRegistry corsRegistry) {
    if (!properties.isEnable()) {
      return;
    }
    for (CorsConfiguration config : properties.getConfigs()) {
      corsRegistry.addMapping(config.getPathPattern())
          .allowedOrigins(config.getAllowedOrigins().toArray(new String[0]))
          .allowedMethods(config.getAllowedMethods().toArray(new String[0]))
          .allowedHeaders(config.getAllowedHeaders().toArray(new String[0]))
          .exposedHeaders(config.getExposedHeaders().toArray(new String[0]))
          .maxAge(config.getMaxAge())
          .allowCredentials(config.isAllowCredentials());
    }
  }

}
File Line
org/bremersee/security/authentication/JwtSupportAutoConfiguration.java 62
org/bremersee/security/authentication/ReactiveJwtSupportAutoConfiguration.java 61
public JwtSupportAutoConfiguration(
      AuthProperties properties) {
    this.properties = properties;
  }

  /**
   * Init.
   */
  @EventListener(ApplicationReadyEvent.class)
  public void init() {
    log.info("\n"
            + "*********************************************************************************\n"
            + "* {}\n"
            + "*********************************************************************************\n"
            + "* rolesJsonPath = {}\n"
            + "* rolesValueList = {}\n"
            + "* rolesValueSeparator = {}\n"
            + "* rolePrefix = {}\n"
            + "* nameJsonPath = {}\n"
            + "*********************************************************************************",
        ClassUtils.getUserClass(getClass()).getSimpleName(),
        properties.getRolesJsonPath(),
        properties.isRolesValueList(),
        properties.getRolesValueSeparator(),
        properties.getRolePrefix(),
        properties.getNameJsonPath());
  }

  /**
   * Creates authentication details bean.
   *
   * @param messageSourceProperties the message source properties
   * @return the authentication details
   */
  @ConditionalOnMissingBean
  @Bean
  public AuthenticationDetails authenticationDetails(
      MessageSourceProperties messageSourceProperties) {
    return new JsonPathJwtAuthenticationDetails(
        messageSourceProperties.defaultLocale(),
        messageSourceProperties.defaultTimeZone(),
        properties.getPreferredLanguageJsonPath(),
        properties.getPreferredTimeZoneJsonPath());
  }

  /**
   * Creates a json path jwt converter bean.
   *
   * @return the json path jwt converter
   */
  @ConditionalOnProperty(
      prefix = "spring.security.oauth2.resourceserver.jwt",
      name = "jwk-set-uri")
  @ConditionalOnMissingBean
  @Bean
  @SuppressWarnings("DuplicatedCode")
  public JsonPathJwtConverter jsonPathJwtConverter() {