我想用我自己的登錄頁面,以下錯誤登錄: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