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

feat: add refresh token #77

Merged
merged 1 commit into from
Feb 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 3 additions & 2 deletions backend/pms/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,9 @@ target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
# **/src/main/resources/zfilestorage/**
# !**/src/main/resources/zfilestorage/dump/**
**/src/main/resources/zfilestorage/**
!**/src/main/resources/zfilestorage/dump/**

.idea/

### STS ###
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ public class AuthServiceImpl implements AuthService {

@Value("${jwt.secret}")
private String secret;

private final long ACCESS_TOKEN_EXPIRED = 1000 * 60 * 1000; // 10mn
// 3 seconds for testing
private final long ACCESS_TOKEN_EXPIRED = 1000 * 3; // 3s
private final long REFRESH_TOKEN_EXPIRED = 1000 * 60 * 20; // 20mn

private final AuthenticationManager authManager;
Expand Down
2 changes: 1 addition & 1 deletion backend/pms/src/main/resources/application.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,4 @@ management:
jwt:
secret: ${JWT_SECRET:1234}
mail:
enabled: ${ENABLED:false}
enabled: ${ENABLED:true}
44 changes: 22 additions & 22 deletions backend/pms/src/main/resources/data.sql
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ VALUES (
'2de25a4be7b35b4e5bdc85dd1b90dd0b-cc_ft_1536.webp',
374928,
'2024-02-07 00:29:48.620212',
'http://localhost:8080/api/v1/files/18ee8134-c056-4b62-ab9c-de5c5ed1a397/download',
'http://localhost:8080/api/v1/files/dump/18ee8134-c056-4b62-ab9c-de5c5ed1a397/download',
1
),
(
Expand All @@ -151,7 +151,7 @@ VALUES (
'istockphoto-1223671392-612x612.webp',
119848,
'2024-02-07 00:37:40.770564',
'http://localhost:8080/api/v1/files/7dbe103a-ef37-4d40-8514-8b1d305cadbc/download',
'http://localhost:8080/api/v1/files/dump/7dbe103a-ef37-4d40-8514-8b1d305cadbc/download',
2
),
(
Expand All @@ -160,7 +160,7 @@ VALUES (
'70eae94aac25d652feec326f6c956677-cc_ft_768.webp',
81462,
'2024-02-07 00:39:46.315914',
'http://localhost:8080/api/v1/files/cf9af819-c037-4a2f-9d0b-a5266752e1de/download',
'http://localhost:8080/api/v1/files/dump/cf9af819-c037-4a2f-9d0b-a5266752e1de/download',
2
),
(
Expand All @@ -169,7 +169,7 @@ VALUES (
'36a3818de08b1276e999d6644b898bc7-cc_ft_768.webp',
95240,
'2024-02-07 00:44:43.638679',
'http://localhost:8080/api/v1/files/4ddaf5cb-d198-4c4f-bda3-166d0d1720e6/download',
'http://localhost:8080/api/v1/files/dump/4ddaf5cb-d198-4c4f-bda3-166d0d1720e6/download',
2
),
(
Expand All @@ -178,7 +178,7 @@ VALUES (
'681b80dd92692119ba9b5877582ff7b3-cc_ft_768.webp',
133530,
'2024-02-07 00:29:48.619834',
'http://localhost:8080/api/v1/files/255d0f6e-be87-4deb-a8d1-4640941c97e1/download',
'http://localhost:8080/api/v1/files/dump/255d0f6e-be87-4deb-a8d1-4640941c97e1/download',
1
),
(
Expand All @@ -187,7 +187,7 @@ VALUES (
'a4da493447946d23c7dafae95f171ece-cc_ft_768.webp',
57856,
'2024-02-07 00:29:48.62001',
'http://localhost:8080/api/v1/files/216bde52-1811-4e57-a587-41bfc9cf00ab/download',
'http://localhost:8080/api/v1/files/dump/216bde52-1811-4e57-a587-41bfc9cf00ab/download',
1
),
(
Expand All @@ -196,7 +196,7 @@ VALUES (
'f9f46aa3b70545cd8462c399dd3e4cb2-cc_ft_1536.webp',
79694,
'2024-02-07 00:29:48.620092',
'http://localhost:8080/api/v1/files/3d56edd8-d846-498a-a7a0-86abf7f450b8/download',
'http://localhost:8080/api/v1/files/dump/3d56edd8-d846-498a-a7a0-86abf7f450b8/download',
1
),
(
Expand All @@ -205,7 +205,7 @@ VALUES (
'36a3818de08b1276e999d6644b898bc7-cc_ft_768.webp',
95240,
'2024-02-07 00:37:40.77056',
'http://localhost:8080/api/v1/files/d940e58b-fea3-42c4-b8ad-ad0a6fd77d2a/download',
'http://localhost:8080/api/v1/files/dump/d940e58b-fea3-42c4-b8ad-ad0a6fd77d2a/download',
2
),
(
Expand All @@ -214,7 +214,7 @@ VALUES (
'70eae94aac25d652feec326f6c956677-cc_ft_768.webp',
81462,
'2024-02-07 00:37:40.770559',
'http://localhost:8080/api/v1/files/ea5dd452-e0b9-4a5e-a47e-791a51b3f7c8/download',
'http://localhost:8080/api/v1/files/dump/ea5dd452-e0b9-4a5e-a47e-791a51b3f7c8/download',
2
),
(
Expand All @@ -223,7 +223,7 @@ VALUES (
'1c0500ddb4a2c8237f1b05bf4f6b14f0-cc_ft_1536.webp',
150908,
'2024-02-07 00:37:40.770563',
'http://localhost:8080/api/v1/files/dfa22596-db7b-42ce-a421-95ddefbc9c9a/download',
'http://localhost:8080/api/v1/files/dump/dfa22596-db7b-42ce-a421-95ddefbc9c9a/download',
2
),
(
Expand All @@ -232,7 +232,7 @@ VALUES (
'd64f5b44f3f1edca650d6847c696652d-cc_ft_768.webp',
124432,
'2024-02-07 00:37:40.788933',
'http://localhost:8080/api/v1/files/52830c0e-246b-4b48-b6dc-0bda9a4444b8/download',
'http://localhost:8080/api/v1/files/dump/52830c0e-246b-4b48-b6dc-0bda9a4444b8/download',
2
),
(
Expand All @@ -241,7 +241,7 @@ VALUES (
'36a3818de08b1276e999d6644b898bc7-cc_ft_768.webp',
95240,
'2024-02-07 00:39:46.315386',
'http://localhost:8080/api/v1/files/591d9fa5-98e7-4a26-9feb-05e1d711e1bc/download',
'http://localhost:8080/api/v1/files/dump/591d9fa5-98e7-4a26-9feb-05e1d711e1bc/download',
2
),
(
Expand All @@ -250,7 +250,7 @@ VALUES (
'1c0500ddb4a2c8237f1b05bf4f6b14f0-cc_ft_1536.webp',
150908,
'2024-02-07 00:39:46.315794',
'http://localhost:8080/api/v1/files/fa0f3c2e-83dd-40ed-8a57-151cdf8c7490/download',
'http://localhost:8080/api/v1/files/dump/fa0f3c2e-83dd-40ed-8a57-151cdf8c7490/download',
2
),
(
Expand All @@ -259,7 +259,7 @@ VALUES (
'd64f5b44f3f1edca650d6847c696652d-cc_ft_768.webp',
124432,
'2024-02-07 00:39:46.315384',
'http://localhost:8080/api/v1/files/48cf8e8a-31f9-45d4-8521-331d035ed6a9/download',
'http://localhost:8080/api/v1/files/dump/48cf8e8a-31f9-45d4-8521-331d035ed6a9/download',
2
),
(
Expand All @@ -268,7 +268,7 @@ VALUES (
'istockphoto-1223671392-612x612.webp',
119848,
'2024-02-07 00:39:46.315524',
'http://localhost:8080/api/v1/files/7ec7814c-f1d4-40f3-8408-2c9b5ca475ce/download',
'http://localhost:8080/api/v1/files/dump/7ec7814c-f1d4-40f3-8408-2c9b5ca475ce/download',
2
),
(
Expand All @@ -277,7 +277,7 @@ VALUES (
'1c0500ddb4a2c8237f1b05bf4f6b14f0-cc_ft_1536.webp',
150908,
'2024-02-07 00:44:43.638803',
'http://localhost:8080/api/v1/files/20b85878-8ffd-442a-be27-e7b3d1dcc0f1/download',
'http://localhost:8080/api/v1/files/dump/20b85878-8ffd-442a-be27-e7b3d1dcc0f1/download',
2
),
(
Expand All @@ -286,7 +286,7 @@ VALUES (
'd64f5b44f3f1edca650d6847c696652d-cc_ft_768.webp',
124432,
'2024-02-07 00:44:43.638862',
'http://localhost:8080/api/v1/files/cb0ecd6f-0ff2-47e8-9a85-dca4b2d5a50f/download',
'http://localhost:8080/api/v1/files/dump/cb0ecd6f-0ff2-47e8-9a85-dca4b2d5a50f/download',
2
),
(
Expand All @@ -295,7 +295,7 @@ VALUES (
'70eae94aac25d652feec326f6c956677-cc_ft_768.webp',
81462,
'2024-02-07 00:44:43.638934',
'http://localhost:8080/api/v1/files/708d8753-0c03-4442-8ecd-15ef7ce229d6/download',
'http://localhost:8080/api/v1/files/dump/708d8753-0c03-4442-8ecd-15ef7ce229d6/download',
2
),
(
Expand All @@ -304,7 +304,7 @@ VALUES (
'istockphoto-1223671392-612x612.webp',
119848,
'2024-02-07 00:44:43.638987',
'http://localhost:8080/api/v1/files/5d4e5767-6ba6-49f4-8778-25314b25a7ad/download',
'http://localhost:8080/api/v1/files/dump/5d4e5767-6ba6-49f4-8778-25314b25a7ad/download',
2
),
(
Expand All @@ -313,7 +313,7 @@ VALUES (
'71d6d546e79e698652c862e7febb6c84-cc_ft_768.webp',
104744,
'2024-02-07 01:04:03.062579',
'http://localhost:8080/api/v1/files/0d832078-7c8c-4a93-bf2c-4f8c986d7bcc/download',
'http://localhost:8080/api/v1/files/dump/0d832078-7c8c-4a93-bf2c-4f8c986d7bcc/download',
3
),
(
Expand All @@ -322,7 +322,7 @@ VALUES (
'478163394364d24a5c9f5e514143a987-cc_ft_768.webp',
47724,
'2024-02-07 01:04:03.063409',
'http://localhost:8080/api/v1/files/19e4d3b2-b4fe-4260-9082-30c0bbdc4bcd/download',
'http://localhost:8080/api/v1/files/dump/19e4d3b2-b4fe-4260-9082-30c0bbdc4bcd/download',
3
),
(
Expand All @@ -331,7 +331,7 @@ VALUES (
'ffde7376d106d8c16964fdd2be7b4bc6-cc_ft_768.webp',
108156,
'2024-02-07 01:04:03.063517',
'http://localhost:8080/api/v1/files/26e2c78c-def2-4fc9-b34c-21c2eb8994ed/download',
'http://localhost:8080/api/v1/files/dump/26e2c78c-def2-4fc9-b34c-21c2eb8994ed/download',
3
);
INSERT INTO offer(
Expand Down
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
10 changes: 10 additions & 0 deletions frontend/cypress.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
const { defineConfig } = require("cypress");

module.exports = defineConfig({
component: {
devServer: {
framework: "create-react-app",
bundler: "webpack",
},
},
});
5 changes: 5 additions & 0 deletions frontend/cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "[email protected]",
"body": "Fixtures are a great way to mock data for responses to routes"
}
25 changes: 25 additions & 0 deletions frontend/cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
12 changes: 12 additions & 0 deletions frontend/cypress/support/component-index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<title>Components App</title>
</head>
<body>
<div data-cy-root></div>
</body>
</html>
27 changes: 27 additions & 0 deletions frontend/cypress/support/component.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// ***********************************************************
// This example support/component.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')

import { mount } from 'cypress/react18'

Cypress.Commands.add('mount', mount)

// Example use:
// cy.mount(<MyComponent />)
Loading
Loading