我用这个更改了我的 home.route.ts :
export const HOME_ROUTE: Route = {
path: '',
component: HomeComponent,
data: {
authorities: ['ROLE_USER', 'ROLE_ADMIN'],
pageTitle: 'home.title'
},
canActivate: [UserRouteAccessService]
};
但是,在终端日志中,我每毫秒都会看到大量错误,如下所示:
2020-04-28 15:01:31.284 DEBUG 3588 --- [ XNIO-1 task-66] c.m.m.r.CustomAuditEventRepository : Exit: add() with result = null
2020-04-28 15:01:31.285 WARN 3588 --- [ XNIO-1 task-66] o.z.problem.spring.common.AdviceTraits : Unauthorized: Full authentication is required to access this resource
2020-04-28 15:01:31.286 WARN 3588 --- [ XNIO-1 task-66] .m.m.a.ExceptionHandlerExceptionResolver : Resolved [org.springframework.security.authentication.InsufficientAuthenticationException: Full authentication is required to access
this resource]
在访问路径“”之前登录的最佳方式是什么?
抱歉我的英语基础不好,我的第一语言是法语。
最佳答案
我最近在 Angular 的 JHipster 应用程序中经历了类似的事情。
这是由于页面布局中包含一些需要了解用户的组件:导航栏、开发功能区......
默认情况下,JHipster 使用模式登录表单,这意味着此弹出窗口显示在包含我上面提到的布局组件的页面中。
我的解决方案是创建一个登录屏幕,该屏幕具有映射在 /login
路线上的简化布局(例如无导航栏)。
关于angular - 前往 "/"之前需要登录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61488110/