我想创建CustomAuthenticationSuccessHandler
以向每个用户登录添加日志:
class CustomAuthenticationSuccessHandler implements AuthenticationSuccessHandler{
UserService getUserService() {
return ApplicationContextHolder.getBean('userService')
}
@Override
public void onAuthenticationSuccess(HttpServletRequest req,
HttpServletResponse res, Authentication auth) throws IOException,
ServletException {
userService.postLoginMessage(auth.principal.username, null)
}
}
它的代码简单,运行良好,但现在我没有返回值。有没有办法在我的自定义代码运行后调用默认的AuthenticationSuccessHandler
或返回默认值?
我的意思是返回Authentication
json。
答案 0 :(得分:1)
You're doing it wrong essentially.
Instead of overriding the success handler, you should register an event listener.
Config:
.buttonClass{
vertical-align:middle;
}
Register a class as a bean
StratifiedKFold(n_splits=10, shuffle=True, random_state=0)