Skip to content

Commit f7bddb9

Browse files
committed
feat(springSecurity): add spring security in app
1 parent e856fe6 commit f7bddb9

3 files changed

Lines changed: 15 additions & 14 deletions

File tree

.github/workflows/sonar.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@ jobs:
4343
printf '%s' "${{ secrets.APPLICATION_TEST_PROPERTIES }}" | base64 -d >> src/test/resources/application-test.properties
4444
fi
4545
echo "spring.sql.init.mode=never" >> src/test/resources/application-test.properties
46-
mvn clean verify sonar:sonar -DskipDocker=true -Dsonar.qualitygate.wait=true -Dit.test="!CucumberIntegrationTest
46+
mvn clean verify sonar:sonar -DskipDocker=true -Dsonar.qualitygate.wait=true "-Dit.test=!CucumberIntegrationTest"

.github/workflows/tests.yaml

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,12 +38,11 @@ jobs:
3838
3939
- name: Prepare Docker .env for CI tests
4040
run: |
41-
cat > .env <<EOF
42-
POSTGRES_USER=${{ secrets.POSTGRES_USER }}
43-
POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }}
44-
POSTGRES_DB=${{ secrets.POSTGRES_DB }}
45-
POSTGRES_PORT=${{ secrets.POSTGRES_PORT }}
46-
EOF
41+
printf '%s\n' \
42+
"POSTGRES_USER=${{ secrets.POSTGRES_USER }}" \
43+
"POSTGRES_PASSWORD=${{ secrets.POSTGRES_PASSWORD }}" \
44+
"POSTGRES_DB=${{ secrets.POSTGRES_DB }}" \
45+
"POSTGRES_PORT=${{ secrets.POSTGRES_PORT }}" > .env
4746
4847
- name: Install Docker Compose
4948
run: |

src/test/java/feature/SpringIntegrationTest.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,13 @@ protected void executeDelete(String path) {
6666
.exchange(url, HttpMethod.DELETE, HttpEntity.EMPTY, String.class);
6767
}
6868

69-
protected void executePut(String path, Object payload) {
70-
String url = "http://localhost:" + port + path;
71-
HttpHeaders headers = new HttpHeaders();
72-
headers.setContentType(MediaType.APPLICATION_JSON);
73-
HttpEntity<Object> request = new HttpEntity<>(payload, headers);
74-
latestResponse = restTemplate.exchange(url, HttpMethod.PUT, request, String.class);
75-
}
69+
protected void executePut(String path, Object payload) {
70+
String url = "http://localhost:" + port + path;
71+
HttpHeaders headers = new HttpHeaders();
72+
headers.setContentType(MediaType.APPLICATION_JSON);
73+
HttpEntity<Object> request = new HttpEntity<>(payload, headers);
74+
latestResponse = restTemplate
75+
.withBasicAuth(testUsername, testPassword)
76+
.exchange(url, HttpMethod.PUT, request, String.class);
77+
}
7678
}

0 commit comments

Comments
 (0)