Skip to content

realization jv web security#680

Open
bigvini wants to merge 9 commits into
mate-academy:masterfrom
bigvini:hw-solution-jv-web-security
Open

realization jv web security#680
bigvini wants to merge 9 commits into
mate-academy:masterfrom
bigvini:hw-solution-jv-web-security

Conversation

@bigvini
Copy link
Copy Markdown

@bigvini bigvini commented Aug 20, 2023

No description provided.

Driver driver = authenticationService.login(login, password);
HttpSession session = req.getSession();
session.setAttribute("id", driver.getId());
resp.sendRedirect("/index");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

add contextPath

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

not fixed

req.setAttribute("cars", cars);
req.getRequestDispatcher("/WEB-INF/views/cars/all.jsp").forward(req, resp);
} else {
resp.sendRedirect("/login");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

contextPath

Comment on lines +17 to +24
Optional<Driver> driver = driverDao.findByLogin(login);
if (driver.isEmpty()) {
throw new AuthenticationException("Driver login or password incorrect");
}
if (driver.get().getPassword().equals(password)) {
return driver.get();
}
throw new AuthenticationException("Driver login or password incorrect");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

image

Comment on lines +12 to +13
@Inject
private DriverDao driverDao;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

lets use service instead

Comment on lines +33 to +41
if (id == null && allowedUrl.contains(req.getServletPath())) {
chain.doFilter(req, resp);
return;
}
if (id == null) {
resp.sendRedirect("/login");
return;
}
chain.doFilter(req, resp);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

image

@bigvini bigvini requested a review from aaananas August 20, 2023 16:44
Driver driver = authenticationService.login(login, password);
HttpSession session = req.getSession();
session.setAttribute("id", driver.getId());
resp.sendRedirect("/index");
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

not fixed

@bigvini bigvini requested a review from okuzan August 21, 2023 10:24
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.

3 participants