mirror of
https://gitee.com/dromara/MaxKey.git
synced 2026-05-19 18:29:42 +08:00
Authentication 优化
This commit is contained in:
@@ -21,7 +21,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.maxkey.authn.AbstractAuthenticationProvider;
|
||||
import org.maxkey.authn.BasicAuthentication;
|
||||
import org.maxkey.authn.LoginCredential;
|
||||
import org.maxkey.authn.support.jwt.JwtLoginService;
|
||||
import org.maxkey.authn.support.rememberme.AbstractRemeberMeService;
|
||||
import org.maxkey.configuration.ApplicationConfig;
|
||||
@@ -110,12 +110,12 @@ public class LoginEndpoint {
|
||||
}
|
||||
|
||||
@RequestMapping(value={"/logon.do"})
|
||||
public ModelAndView logon(@ModelAttribute("authentication") BasicAuthentication authentication) {
|
||||
public ModelAndView logon(@ModelAttribute("loginCredential") LoginCredential loginCredential) {
|
||||
|
||||
if(WebContext.isAuthenticated()){
|
||||
return WebContext.redirect("/main");
|
||||
}else{
|
||||
authenticationProvider.authenticate(authentication);
|
||||
authenticationProvider.authenticate(loginCredential);
|
||||
return WebContext.redirect("/login");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import javax.servlet.RequestDispatcher;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.maxkey.authn.BasicAuthentication;
|
||||
import org.maxkey.authn.SigninPrincipal;
|
||||
import org.maxkey.configuration.ApplicationConfig;
|
||||
import org.maxkey.web.WebContext;
|
||||
import org.slf4j.Logger;
|
||||
@@ -68,7 +68,7 @@ public class PermissionAdapter extends HandlerInterceptorAdapter {
|
||||
}
|
||||
|
||||
//非管理员用户直接注销
|
||||
if (!((BasicAuthentication) WebContext.getAuthentication().getPrincipal()).isRoleAdministrators()) {
|
||||
if (!((SigninPrincipal) WebContext.getAuthentication().getPrincipal()).isRoleAdministrators()) {
|
||||
_logger.debug("Not ADMINISTRATORS Authentication .");
|
||||
RequestDispatcher dispatcher = request.getRequestDispatcher("/logout");
|
||||
dispatcher.forward(request, response);
|
||||
|
||||
Reference in New Issue
Block a user