我想用我自己的登录页面,以下错误登录:Spring Security的登录与自己的登录页面无法正常工作
白色标签错误页面 此应用对/错误没有明确的映射,所以你看到这是一个后备。 Tue Aug 22 07:52:15 CEST 2017 有一个意外的错误(type = Not Found,status = 404)。 无
消息北京时间这里我SecurityConfiguration
@Configuration
@EnableGlobalMethodSecurity(prePostEnabled = true)
@EnableWebSecurity
public class SecurityConfiguration extends WebSecurityConfigurerAdapter {
@Override
protected void configure(HttpSecurity http) throws Exception {
http.authorizeRequests().antMatchers("/login", "/css/**",
"/image/**").permitAll().anyRequest()
.authenticated().and().formLogin().loginPage("/login.html").permitAll()
.and().logout().permitAll().and().csrf().disable();
}
@Autowired
protected void configureLDAP(AuthenticationManagerBuilder auth) throws Exception {
auth.ldapAuthentication().userSearchFilter("uid={0}").contextSource()
.url("ldap://ldap.forumsys.com:389/dc=example,dc=com").managerPassword("password");
}
登录
<!doctype html>
<html lang="de">
<head>
<meta charset="utf-8">
<title>Login</title>
<meta name="description" content="description">
<meta name="author" content="author">
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<div class="container">
<div class="background"> </div>
<div class="card">
<img style="height:60px; width: auto; margin: 45px 100px;" src="image/picture.png">
<form name="f" action="/login" method="POST">
<div class="input">
<input placeholder="Benutzername" type="text" class="" name="username" required>
</div>
<div class="input">
<input placeholder="Passwort" type="password" class="" name="password" required>
</div>
<div class="">
<input name="submit" value="Login" class="btn" type="submit">
</div>
</form>
</div>
</div>
</body>
</html>
登录页面从春天它的工作原理没有问题。
spring无法找到错误page.maybe你必须在'configure()'中加入它。你应该谷歌你的错误信息。那里有答案。像这样https://stackoverflow.com/questions/31134333/this-application-has-no-explicit-mapping-for-error或https://stackoverflow.com/questions/36819277/issue-with-spring-there- was-an-unexpected-error-type-not-found-status-404 –
我认为问题在于,那春天找不到我的登录页面。 – Paddy3108