我想问一下如何创建安全登录。
到目前为止我只有一个登录 View ,现在想问一下如何在成功登录后更改 View 。通过 MySQL 数据库的登录检查也可以正常运行。我只是不希望有人只是在 url 中添加“仪表板”并跳过登录。
@Route("login")
@PageTitle("Login")
public class LoginView extends VerticalLayout {
private final LoginService loginService;
private LoginOverlay loginOverlay = new LoginOverlay();
public LoginView(LoginService loginService) {
this.loginService = loginService;
this.loginOverlay.setOpened(true);
this.loginOverlay.setForgotPasswordButtonVisible(false);
this.loginOverlay.setDescription(null);
this.loginOverlay.setEnabled(true);
this.loginOverlay.addLoginListener(e -> {
if (this.loginService.authenticateUser(e.getUsername(), e.getPassword())) {
?
} else {
this.loginOverlay.setError(true);
}
});
this.add(loginOverlay);
}
}
最佳答案
有一个 vaadin + spring security 教程系列。
https://vaadin.com/tutorials/securing-your-app-with-spring-security
关于java - 如何创建安全的 vaadin 14 登录表单?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58525906/