0
我使用Spring Security的4 我有我的配置,如:登录不登录表单工作
http
.requiresChannel()
.and()
.authorizeRequests()
.antMatchers("<URLS>").hasAnyAuthority(CUSTOMER.toUpperCase(), BRANCH.toUpperCase())
.and()
.authorizeRequests()
.anyRequest().authenticated()
.and()
.formLogin()
这个配置,我能够访问Spring的登录网址:
localhost:9080/contextpath/login?username=BNH123456&password=pass
但现在当我使用登录表单配置如下:
http
.requiresChannel()
.and()
.authorizeRequests()
.antMatchers("<URLS>").hasAnyAuthority(CUSTOMER.toUpperCase(), BRANCH.toUpperCase())
.and()
.authorizeRequests()
.anyRequest().authenticated()
.and()
.formLogin()
.loginPage(journey.equalsIgnoreCase("customer") ? "/" : "/#!/login")
我无法访问Spring的登录URL。它说:
错误404
是否有必要定义一个定制的控制器时,我定义登录表单?
我想使用我的自定义登录表单,但它使用Spring的登录URL。 (如果我使用邮递员发出登录请求,它应该进行身份验证。)
任何人都可以请指导。
'#'将不会在服务器上接收那些客户端锚点并不会被发送到服务器。 –
我们在前端使用角度,我们有两种类型的旅程。对于客户旅程,我的起始页面是“/”,但对于员工旅程,我的起始页面是“/#!/ login”。 angular将用户名和密码发送到后端进行验证。当我没有把“loginform”工作正常,但是当我添加时,相同的URL localhost:9080/contextpath/login?username = BNH123456&password = pass 停止工作。 – kenthewala
为什么它应该不同...只需调用相同的入口点即可。没有你的首页不是'/#!/ login',它仍然是'/'。 Angular分析'#!/ login'部分。 –