Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPMRPP-97288 decouple commons libraries #352

Open
wants to merge 6 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "migrations"]
path = migrations
url = https://github.com/reportportal/migrations
61 changes: 43 additions & 18 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,7 @@ ext['hibernate-validator.version'] = '6.1.5.Final'
ext['log4j2.version'] = '2.21.1'


dependencyManagement {
imports {
mavenBom(releaseMode ? 'com.epam.reportportal:commons-bom:' + '5.13.0' : 'com.epam.reportportal:commons-bom:5.13.0')
}
}

dependencies {
if (releaseMode) {
api 'com.epam.reportportal:commons-dao'
api 'com.epam.reportportal:commons'
} else {
api 'com.github.reportportal:commons-dao:develop-SNAPSHOT'
api 'com.github.reportportal:commons:develop-SNAPSHOT'
}

//Fix CVE-2021-41079, CVE-2022-23181, CVE-2021-33037, CVE-2021-30640, CVE-2022-42252, CVE-2023-46589, CVE-2024-24549
implementation 'org.apache.tomcat.embed:tomcat-embed-core:9.0.86'
implementation 'org.apache.tomcat.embed:tomcat-embed-el:9.0.86'
Expand All @@ -59,7 +45,11 @@ dependencies {
api 'org.apache.httpcomponents:httpclient:4.5.14'
//Fix CVE-2022-40152
api 'com.fasterxml.woodstox:woodstox-core:6.5.1'

implementation('org.springframework.boot:spring-boot-starter-data-jpa') {
exclude group: 'org.hibernate', module: 'hibernate-core'
}
implementation 'org.postgresql:postgresql:42.7.3'
api 'org.jasypt:jasypt:1.9.3'
api 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.springframework.boot:spring-boot-starter-actuator'
api 'org.springframework.boot:spring-boot-starter-security'
Expand All @@ -69,13 +59,23 @@ dependencies {
//Fix CVE-2023-40827, CVE-2023-40828, CVE-2023-40826
implementation 'org.springframework:spring-webmvc:5.3.39'
implementation 'org.springframework:spring-web:5.3.39'
implementation "org.apache.commons:commons-lang3:${commonsLangVersion}"
implementation 'net.coobird:thumbnailator:0.4.20'
implementation("org.apache.tika:tika-core:3.0.0")

api "org.apache.jclouds.api:s3:${jclouds}" // 2.6.0 switched to jakarta annotations!
implementation "org.apache.jclouds.provider:aws-s3:${jclouds}"
implementation "org.apache.jclouds.api:filesystem:${jclouds}"
api('commons-validator:commons-validator:1.6') {
exclude group: 'commons-beanutils', module: 'commons-beanutils'
}

///// Security
//https://nvd.nist.gov/vuln/detail/CVE-2020-5407 AND https://nvd.nist.gov/vuln/detail/CVE-2020-5408
implementation 'org.springframework.security:spring-security-core:5.8.16'
implementation 'org.springframework.security:spring-security-config:5.8.16'
implementation 'org.springframework.security:spring-security-web:5.8.16'
implementation 'org.springframework:spring-jdbc:6.1.5'
implementation 'org.springframework:spring-jdbc:5.3.33'
//

api 'org.springframework.security:spring-security-oauth2-client'
Expand Down Expand Up @@ -108,7 +108,7 @@ dependencies {
// TODO: snakeyaml 2.0 supported by Spring Boot 2.7 and 3.X only
// We don't user application.yml, so it's safe to use 2.2
implementation 'org.yaml:snakeyaml:2.2'
implementation 'org.hibernate:hibernate-core:5.4.24.Final'
implementation 'org.hibernate:hibernate-core:5.6.15.Final'
implementation 'org.springframework:spring-core:5.3.39'
implementation "com.rabbitmq:http-client:5.2.0"

Expand All @@ -117,6 +117,22 @@ dependencies {
annotationProcessor "org.projectlombok:lombok:${lombokVersion}"
testCompileOnly "org.projectlombok:lombok:${lombokVersion}"
testAnnotationProcessor "org.projectlombok:lombok:${lombokVersion}"

testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.flywaydb.flyway-test-extensions:flyway-spring-test:6.1.0'

// testImplementation 'org.springframework.boot:spring-boot-testcontainers:' // spring boot 3.1+
// compileOnly("org.springframework.boot:spring-boot-devtools")
implementation platform("org.testcontainers:testcontainers-bom:${testContainers}")
testImplementation "org.testcontainers:junit-jupiter:${testContainers}"
testImplementation "org.testcontainers:postgresql:${testContainers}"
testImplementation("org.testcontainers:minio:${testContainers}")

}


tasks.register('updateSubmodule', Exec) {
commandLine 'git', 'submodule', 'update', '--init'
}

processResources {
Expand All @@ -141,10 +157,19 @@ bootJar {
jar.enabled(true)
jar.archiveClassifier.set('')

test {
jvmArgs '--add-opens=java.base/java.lang=ALL-UNNAMED' // TODO: remove in Spring Boot 3
useJUnitPlatform()
testLogging {
events = ["failed"]
exceptionFormat = "short"
}
}

compileJava.dependsOn updateSubmodule
publish.dependsOn build
publish.mustRunAfter build

tasks.preTagCommit.enabled = false
tasks.updateVersion.enabled = false
tasks.commitNewVersion.enabled = false
tasks.commitNewVersion.enabled = false
3 changes: 3 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,6 @@ dockerJavaOptsDev=-Xmx1g -XX:+UseG1GC -XX:InitiatingHeapOccupancyPercent=70 -XX:
dockerServerUrl=unix:///var/run/docker.sock

lombokVersion=1.18.30
commonsLangVersion=3.9
testContainers=1.20.4
jclouds=2.5.0
1 change: 1 addition & 0 deletions migrations
Submodule migrations added at ef2fb9
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UserDetailsService;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
Expand All @@ -34,6 +35,8 @@
*
* @author <a href="mailto:[email protected]">Andrei Varabyeu</a>
*/

@Service
public class DatabaseUserDetailsService implements UserDetailsService {

private UserRepository userRepository;
Expand All @@ -46,7 +49,8 @@ public void setUserRepository(UserRepository userRepository) {
@Override
@Transactional(readOnly = true)
public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
ReportPortalUser user = userRepository.findUserDetails(normalizeId(username))
ReportPortalUser user = userRepository.findByLogin(normalizeId(username))
.map(rpUser -> ReportPortalUser.userBuilder().fromUser(rpUser))
.orElseThrow(() -> new UsernameNotFoundException("User not found"));

UserDetails userDetails = org.springframework.security.core.userdetails.User.builder()
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright 2019 EPAM Systems
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.epam.reportportal.auth.config;

import com.zaxxer.hikari.HikariConfig;
import com.zaxxer.hikari.HikariDataSource;
import javax.sql.DataSource;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Primary;

/**
* @author <a href="mailto:[email protected]">Ihar Kahadouski</a>
*/
@Configuration
@ConfigurationProperties(prefix = "rp.datasource")
public class DataSourceConfig extends HikariConfig {

@Primary
@Bean
public DataSource dataSource() {
return new HikariDataSource(this);
}

}
Loading
Loading