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

Code Review #10

Open
wants to merge 30 commits into
base: code-review
Choose a base branch
from
Open

Code Review #10

wants to merge 30 commits into from

Conversation

DziedzicGrzegorz
Copy link
Owner

No description provided.

…isolation and efficiency

Migrated the complete build pipeline of our monorepo to Docker containers, leveraging multi-stage builds for optimized performance. This shift ensures full isolation from the local environment, enhancing consistency and scalability.
Authentication mechanism for efficient user verification. This update includes token generation, validation, and automated handling of token expiry and refresh scenarios.
Refactor Dto and add error message for incorrect request
Delete unnecessary filter chain in AuthTokenFilter
Delete unused TokenDto
Implement Backend with JWT Authentication
Add a AES encryption and decryption module including controller, service, and repository layers. This module provides functionalities to securely encrypt and decrypt messages using AES algorithm
 - browser behavior realize me what filterChain really do
 - exceptionHandling cause that browser client get 401 on bad auth instead of 200
BREAKING CHANGE: Issue with Handling Multiple Clients Using a Single Account: storage token
fixed unexcepted behavior in browser
refactor(MessageController): Add response entity
- added hook for auth
- login/register page
- simple router logic
- error page
- Added registration, login, and logout functionality for improved user experience.
- Updated dashboard with a backend-connected table and hover cards for extended text.
- Improved error handling for smoother user interactions across authentication and dashboard usage.
- encryption and decryption logic
feat(frontend): Enhance auth flow, dashboard, and error handling
Added max 140 char length because of encryption
}

@NotBlank(message = "The email is required.")
@Pattern(regexp = "^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\\.[a-zA-Z]{2,}$", message = "Invalid email address.")
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wszystkie regexy do stałych w osobnej klasie

import lombok.*;

@EqualsAndHashCode(callSuper = true)
@Data
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

na Entity lepiej nie stosować @DaTa

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.


authenticationManager.authenticate(new UsernamePasswordAuthenticationToken(user.getUsername(), request.getPassword()));
//@TODO only one user can be logged in at the same time
revokeAndDeleteAllUserTokens(user);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

czemu nie może być 2 sesji na raz?

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

jeśli przy logowaniu/rejestracji usuwam/bądź unieważniam tokeny dostępne w bazie danego użytkownika to koliduje.
Tu chodzi o to, że jeden użytkownik nie może być zalogowany np. na 2 urządzeniach

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tokenów JWT lepiej nie trzymać w bazie bo szybko sie zawali, można trzymać w pamięci i co restart backendu tworzyć nowy JWT secret.

Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

początkowo chciałem usuwać co logowanie ale pojawił się problem 2 sesji jednego użytkownika czego nie przewidziałem. Co do JWT secret to racja. Nie jestem przekonany co do trzymania tokenów w ramie to też szybko można zawalić

Comment on lines +14 to +44
const router = createBrowserRouter([
{
path: "/",
element: <Navigate to="/login" replace/>,
},
{
path: "/login",
element: (
<>
<LoginPage/>
<Toaster/>
</>
)
},
{
path: "/dashboard",
element: (
<RequireAuth>
<Dashboard/>
<Toaster/>
<div className="absolute left-5 top-5">
<Logout/>
</div>
</RequireAuth>
),
},
{
path: "*",
element: <PageNotFound/>,
},
]);
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do osobnego componentu

const {toast} = useToast();
const [dialogOpen, setDialogOpen] = useState(false);

const onSubmit: SubmitHandler<EncryptRequest> = async (data) => {
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

zapytania do api do osobnych hooków, najlepiej z react query

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants