Загрузка данных


dmitriev-aal@VDI-Dmitriev-A:~/Desktop/rshbintech/intrabank/hrplatform/hrtech$ sed -n '1,200p' resource-and-cost-planning/src/main/java/ru/rshbintech/hrtech/prizstaff/configuration/SecurityConfig.java
package ru.rshbintech.hrtech.prizstaff.configuration;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
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.config.http.SessionCreationPolicy;
import org.springframework.security.oauth2.jwt.JwtDecoder;
import org.springframework.security.oauth2.jwt.NimbusJwtDecoder;
import org.springframework.security.web.SecurityFilterChain;

import java.security.KeyFactory;
import java.security.interfaces.RSAPublicKey;
import java.security.spec.X509EncodedKeySpec;
import java.util.Base64;

@Slf4j
@Configuration
@EnableWebSecurity
public class SecurityConfig {

    @Value("${security.jwt.public-key}")
    private String publicKeyPem;

    @Bean
    public SecurityFilterChain securityFilterChain(HttpSecurity http) throws Exception {
        http
                .csrf(AbstractHttpConfigurer::disable)
                .sessionManagement(session -> session.sessionCreationPolicy(SessionCreationPolicy.STATELESS))
                .authorizeHttpRequests(auth -> auth
                        .requestMatchers("/api/v1/priz/staffScheduleViewer/**").authenticated()
                        .anyRequest().permitAll()
                )
                .oauth2ResourceServer(oauth2 -> oauth2
                        .jwt(jwt -> jwt.decoder(jwtDecoder()))
                );
        return http.build();
    }

    @Bean
    public JwtDecoder jwtDecoder() {
        try {
            log.debug("Initializing JWT decoder with public key: {}", publicKeyPem);
            String cleanedKey = publicKeyPem
                    .replace("-----BEGIN PUBLIC KEY-----", "")
                    .replace("-----END PUBLIC KEY-----", "")
                    .replaceAll("\\s", "");
            log.debug("Cleaned public key: {}", cleanedKey);
            byte[] keyBytes = Base64.getDecoder().decode(cleanedKey);
            log.debug("Decoded key bytes length: {}", keyBytes.length);
            X509EncodedKeySpec spec = new X509EncodedKeySpec(keyBytes);
            KeyFactory keyFactory = KeyFactory.getInstance("RSA");
            RSAPublicKey publicKey = (RSAPublicKey) keyFactory.generatePublic(spec);
            log.info("JWT decoder initialized successfully");
            return NimbusJwtDecoder.withPublicKey(publicKey).build();
        } catch (Exception e) {
            log.error("Failed to initialize JWT decoder", e);
            throw new RuntimeException("Invalid public key configuration", e);
        }
    }
}dmitriev-aal@VDI-Dmitriev-A:~/Desktop/rshbintech/intrabank/hrplatform/hrtech$ grep -R -n "positionCommonInfo" resource-and-cost-planning/src/main/java
resource-and-cost-planning/src/main/java/ru/rshbintech/hrtech/prizstaff/service/impl/StaffInfoServiceImpl.java:330:        PositionCommonInfoDto positionCommonInfoDto = new PositionCommonInfoDto();
resource-and-cost-planning/src/main/java/ru/rshbintech/hrtech/prizstaff/service/impl/StaffInfoServiceImpl.java:334:                    if (!StringUtils.hasText(positionCommonInfoDto.getLegalEntityId()))
resource-and-cost-planning/src/main/java/ru/rshbintech/hrtech/prizstaff/service/impl/StaffInfoServiceImpl.java:335:                        positionCommonInfoDto.setLegalEntityId(managementPosition.getLegalEntity());
resource-and-cost-planning/src/main/java/ru/rshbintech/hrtech/prizstaff/service/impl/StaffInfoServiceImpl.java:336:                    if (!StringUtils.hasText(positionCommonInfoDto.getIdFte()))
resource-and-cost-planning/src/main/java/ru/rshbintech/hrtech/prizstaff/service/impl/StaffInfoServiceImpl.java:337:                        positionCommonInfoDto.setIdFte(managementPosition.getIdFte());
resource-and-cost-planning/src/main/java/ru/rshbintech/hrtech/prizstaff/service/impl/StaffInfoServiceImpl.java:338:                    if (!StringUtils.hasText(positionCommonInfoDto.getJobTitleName())
resource-and-cost-planning/src/main/java/ru/rshbintech/hrtech/prizstaff/service/impl/StaffInfoServiceImpl.java:340:                        positionCommonInfoDto.setJobTitleName(managementPosition.getJobTitle().getName());
resource-and-cost-planning/src/main/java/ru/rshbintech/hrtech/prizstaff/service/impl/StaffInfoServiceImpl.java:341:                    if (!StringUtils.hasText(positionCommonInfoDto.getRole())
resource-and-cost-planning/src/main/java/ru/rshbintech/hrtech/prizstaff/service/impl/StaffInfoServiceImpl.java:343:                        positionCommonInfoDto.setRole(managementPosition.getRole().getName());
resource-and-cost-planning/src/main/java/ru/rshbintech/hrtech/prizstaff/service/impl/StaffInfoServiceImpl.java:388:        positionCommonInfoDto.setPools(pools);
resource-and-cost-planning/src/main/java/ru/rshbintech/hrtech/prizstaff/service/impl/StaffInfoServiceImpl.java:389:        positionCommonInfoDto.setUnits(units);
resource-and-cost-planning/src/main/java/ru/rshbintech/hrtech/prizstaff/service/impl/StaffInfoServiceImpl.java:390:        return positionCommonInfoDto;