Skip to content

Commit 58ad870

Browse files
Merged the master branch into the EFRS-1286_the_ability_to_delete_expired_access_and_refresh_tokens branch
2 parents c3e5439 + 2099962 commit 58ad870

File tree

56 files changed

+1266
-124
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+1266
-124
lines changed

.github/workflows/Build-Deploy-auto.yml

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,8 @@ jobs:
1919
# We need to share it between build and deploy jobs.
2020
outputs:
2121
registry_path: ${{ steps.registry_path.outputs.registry_path }}
22-
tag: ${{ steps.tag_var.outputs.tag }}
22+
tag: ${{ steps.tag_vars.outputs.tag }}
23+
tag_latest: ${{ steps.tag_vars.outputs.tag_latest }}
2324
env_name: ${{ steps.env_var.outputs.env_name }}
2425

2526
steps:
@@ -30,9 +31,11 @@ jobs:
3031
id: registry_path
3132
run: echo "registry_path=${{ env.REGISTRY }}/exadel-inc/compreface/" >> $GITHUB_OUTPUT
3233

33-
- name: Set commit sha output from git
34-
id: tag_var
35-
run: echo "tag=${{ github.ref_name }}-$(git rev-parse HEAD | cut -c 1-7 | tr -d '\n')" >> $GITHUB_OUTPUT
34+
- name: Set tags from git output
35+
id: tag_vars
36+
run: |
37+
echo "tag=${{ github.ref_name }}-$(git rev-parse HEAD | cut -c 1-7 | tr -d '\n')" >> $GITHUB_OUTPUT
38+
echo "tag_latest=${{ github.ref_name }}-latest" >> $GITHUB_OUTPUT
3639
3740
- name: Set environment output from git
3841
id: env_var
@@ -48,19 +51,21 @@ jobs:
4851
- name: Check outputs
4952
run: |
5053
echo "Branch : ${{ github.ref_name }}"
51-
echo "TAG : ${{ steps.tag_var.outputs.tag }}"
54+
echo "Tags : ${{ steps.tag_vars.outputs.tag }}, ${{ steps.tag_vars.outputs.tag_latest }}"
5255
echo "Environment: ${{ steps.env_var.outputs.env_name }}"
5356
5457
- name: Build images
5558
env:
56-
TAG: ${{ steps.tag_var.outputs.tag }}
59+
TAG: ${{ steps.tag_vars.outputs.tag }}
60+
TAG_LATEST: ${{ steps.tag_vars.outputs.tag_latest }}
5761
REGISTRY_PATH: ${{ steps.registry_path.outputs.registry_path }}
58-
APPERY_API_KEY: ${{ secrets.APPERY_API_KEY }}
5962
working-directory: ./dev
6063
run: |
6164
sed -i "s|registry=|registry=${REGISTRY_PATH}|g" .env
6265
sed -i "s/latest/${TAG}/g" .env
6366
docker-compose build
67+
sed -i "s/${TAG}/${TAG_LATEST}/g" .env
68+
docker-compose build
6469
docker images
6570
6671
- name: Log in to the Container registry
@@ -71,16 +76,21 @@ jobs:
7176
password: ${{ secrets.GITHUB_TOKEN }}
7277

7378
- name: Push images to the Container registry
79+
env:
80+
TAG: ${{ steps.tag_vars.outputs.tag }}
81+
TAG_LATEST: ${{ steps.tag_vars.outputs.tag_latest }}
7482
working-directory: ./dev
7583
run: |
7684
docker-compose push
85+
sed -i "s/${TAG_LATEST}/${TAG}/g" .env
86+
docker-compose push
7787
7888
deploy:
7989
needs: build
8090
# It's not possible to use natively env (e.g. env.ENV_NAME) variable on the runs-on job field (yet?)
8191
# for deploy to different environments depending on branch https://github.com/actions/runner/issues/480
8292
# That's why we use output from the previous build job
83-
# Note: we are using self-hosted runner here
93+
# Note: we are using self-hosted runner here
8494
runs-on: ["${{needs.build.outputs.env_name}}"]
8595

8696
steps:
@@ -90,11 +100,11 @@ jobs:
90100
- name: Deploy
91101
working-directory: ./dev
92102
env:
93-
TAG: ${{ needs.build.outputs.tag }}
103+
TAG_LATEST: ${{ needs.build.outputs.tag_latest }}
94104
REGISTRY_PATH: ${{ needs.build.outputs.registry_path }}
95105
run: |
96106
sed -i "s|registry=|registry=${REGISTRY_PATH}|g" .env
97-
sed -i "s/latest/${TAG}/g" .env
107+
sed -i "s/latest/${TAG_LATEST}/g" .env
98108
sudo docker-compose stop
99109
sudo docker system prune -a -f
100110
sudo docker-compose pull
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
name: Deploy to QA or Demo environment manually
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
environment:
7+
type: choice
8+
description: 'Choose environment to deploy'
9+
required: true
10+
default: 'qa'
11+
options:
12+
- qa
13+
- demo
14+
15+
env:
16+
REGISTRY_PATH: ghcr.io/exadel-inc/compreface/
17+
18+
jobs:
19+
deploy:
20+
runs-on: ${{ github.event.inputs.environment }}
21+
22+
steps:
23+
24+
- name: Set environment output from git
25+
id: tag_var
26+
run: |
27+
if [ "${{ github.event.inputs.environment }}" = "qa" ]; then
28+
echo "TAG_LATEST=master-latest" >> $GITHUB_ENV
29+
else
30+
echo "TAG_LATEST=1.1.x-latest" >> $GITHUB_ENV
31+
fi
32+
33+
- name: Checkout Repo
34+
uses: actions/checkout@v3
35+
36+
- name: Deploy
37+
working-directory: ./dev
38+
run: |
39+
sed -i "s|registry=|registry=${{ env.REGISTRY_PATH }}|g" .env
40+
sed -i "s/latest/${{ env.TAG_LATEST }}/g" .env
41+
sudo docker-compose stop
42+
sudo docker system prune -a -f
43+
sudo docker-compose pull
44+
HOSTNAME=$HOSTNAME sudo docker-compose -f docker-compose.yml -f docker-compose.env.yml up -d

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@
6565
* [Contributing](#contributing)
6666
* [License info](#license-info)
6767

68-
6968
# Overview
7069

7170
Exadel CompreFace is a free and open-source face recognition GitHub project.

java/admin/src/main/java/com/exadel/frs/controller/UserController.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,8 @@ public void assignAndSendResetPasswordToken(
256256
@ApiParam(value = "An email of a user", required = true)
257257
@Valid
258258
@RequestBody
259-
final ForgotPasswordDto forgotPasswordDto,
260-
final HttpServletResponse response) throws IOException {
259+
final ForgotPasswordDto forgotPasswordDto) {
261260
resetPasswordTokenService.assignAndSendToken(forgotPasswordDto.getEmail());
262-
redirectToLoginPage(response);
263261
}
264262

265263
@PutMapping("/reset-password")
@@ -271,11 +269,9 @@ public void resetPassword(
271269
final ResetPasswordDto resetPasswordDto,
272270
@ApiParam(value = "A reset password token", required = true)
273271
@RequestParam
274-
final String token,
275-
final HttpServletResponse response) throws IOException {
272+
final String token) {
276273
val user = resetPasswordTokenService.exchangeTokenOnUser(token);
277274
userService.resetPassword(user, resetPasswordDto.getPassword());
278-
redirectToLoginPage(response);
279275
}
280276

281277
private void redirectToLoginPage(final HttpServletResponse response) throws IOException {

java/admin/src/main/java/com/exadel/frs/dto/ui/AppCreateDto.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616

1717
package com.exadel.frs.dto.ui;
1818

19+
import static com.exadel.frs.commonservice.system.global.RegExConstants.ALLOWED_SPECIAL_CHARACTERS;
1920
import javax.validation.constraints.NotBlank;
21+
import javax.validation.constraints.Pattern;
2022
import javax.validation.constraints.Size;
2123
import lombok.AllArgsConstructor;
2224
import lombok.Builder;
@@ -31,5 +33,6 @@ public class AppCreateDto {
3133

3234
@NotBlank(message = "Application name cannot be empty")
3335
@Size(min = 1, max = 50, message = "Application name size must be between 1 and 50")
36+
@Pattern(regexp = ALLOWED_SPECIAL_CHARACTERS, message = "The name cannot contain the following special characters: ';', '/', '\\'")
3437
private String name;
3538
}

java/admin/src/main/java/com/exadel/frs/dto/ui/AppUpdateDto.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616

1717
package com.exadel.frs.dto.ui;
1818

19+
import static com.exadel.frs.commonservice.system.global.RegExConstants.ALLOWED_SPECIAL_CHARACTERS;
1920
import javax.validation.constraints.NotBlank;
21+
import javax.validation.constraints.Pattern;
2022
import javax.validation.constraints.Size;
2123
import lombok.AllArgsConstructor;
2224
import lombok.Builder;
@@ -31,5 +33,6 @@ public class AppUpdateDto {
3133

3234
@NotBlank(message = "Application name cannot be empty")
3335
@Size(min = 1, max = 50, message = "Application name size must be between 1 and 50")
36+
@Pattern(regexp = ALLOWED_SPECIAL_CHARACTERS, message = "The name cannot contain the following special characters: ';', '/', '\\'")
3437
private String name;
3538
}

java/admin/src/main/java/com/exadel/frs/dto/ui/ModelCloneDto.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616

1717
package com.exadel.frs.dto.ui;
1818

19+
import static com.exadel.frs.commonservice.system.global.RegExConstants.ALLOWED_SPECIAL_CHARACTERS;
1920
import javax.validation.constraints.NotBlank;
21+
import javax.validation.constraints.Pattern;
2022
import javax.validation.constraints.Size;
2123
import lombok.AllArgsConstructor;
2224
import lombok.Builder;
@@ -31,5 +33,6 @@ public class ModelCloneDto {
3133

3234
@NotBlank(message = "Model name cannot be empty")
3335
@Size(min = 1, max = 50, message = "Model name size must be between 1 and 50")
36+
@Pattern(regexp = ALLOWED_SPECIAL_CHARACTERS, message = "The name cannot contain the following special characters: ';', '/', '\\'")
3437
private String name;
3538
}

java/admin/src/main/java/com/exadel/frs/dto/ui/ModelCreateDto.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616

1717
package com.exadel.frs.dto.ui;
1818

19+
import static com.exadel.frs.commonservice.system.global.RegExConstants.ALLOWED_SPECIAL_CHARACTERS;
1920
import com.exadel.frs.commonservice.enums.ModelType;
2021
import com.exadel.frs.validation.ValidEnum;
2122
import javax.validation.constraints.NotBlank;
23+
import javax.validation.constraints.Pattern;
2224
import javax.validation.constraints.Size;
2325
import lombok.AllArgsConstructor;
2426
import lombok.Builder;
@@ -33,6 +35,7 @@ public class ModelCreateDto {
3335

3436
@NotBlank(message = "Model name cannot be empty")
3537
@Size(min = 1, max = 50, message = "Model name size must be between 1 and 50")
38+
@Pattern(regexp = ALLOWED_SPECIAL_CHARACTERS, message = "The name cannot contain the following special characters: ';', '/', '\\'")
3639
private String name;
3740

3841
@NotBlank(message = "Model Type cannot be empty")

java/admin/src/main/java/com/exadel/frs/dto/ui/ModelUpdateDto.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@
1616

1717
package com.exadel.frs.dto.ui;
1818

19+
import static com.exadel.frs.commonservice.system.global.RegExConstants.ALLOWED_SPECIAL_CHARACTERS;
1920
import javax.validation.constraints.NotBlank;
21+
import javax.validation.constraints.Pattern;
2022
import javax.validation.constraints.Size;
2123
import lombok.AllArgsConstructor;
2224
import lombok.Builder;
@@ -31,5 +33,6 @@ public class ModelUpdateDto {
3133

3234
@NotBlank(message = "Model name cannot be empty")
3335
@Size(min = 1, max = 50, message = "Model name size must be between 1 and 50")
36+
@Pattern(regexp = ALLOWED_SPECIAL_CHARACTERS, message = "The name cannot contain the following special characters: ';', '/', '\\'")
3437
private String name;
3538
}

java/admin/src/main/resources/application.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
server:
22
port: ${CRUD_PORT:8080}
3+
tomcat:
4+
relaxed-path-chars: [ '[', ']' ]
5+
relaxed-query-chars: [ '[', ']' ]
36

47
app:
58
security:
@@ -127,7 +130,7 @@ forgot-password:
127130
cron: '0 0 0 * * ?'
128131
email:
129132
subject: 'CompreFace Reset Password'
130-
message: 'In order to reset a password click the following link: %s/admin/reset-password?token=%s'
133+
message: 'In order to reset a password click the following link: %s/reset-password?token=%s'
131134

132135
# "environment" and "image" blocks should be same in those files:
133136
# * api/src/main/resources/application.properties

0 commit comments

Comments
 (0)