У меня есть приложение Spring Boot и настроенная для него весенняя безопасность, он использует пользовательскую страницу входа с простой формой AngularJS, и я пытаюсь пройти аутентификацию через нее, но безуспешно. В моем CurrentUserDetailsService loadUserByUsername (параметр String) параметр param
всегда приходит к нулю, может кто-нибудь мне помочь? я что-то упускаю?Spring Security AngularJS Login
Это моя форма:
<form role="form" action="" name="form" class="">
<fieldset class="pure-group">
<legend>Log In</legend>
<div class="form-group">
<label for="username">Username:</label>
<input type="text" class="form-control" id="username" name="username" ng-model="credentials.username"/>
</div>
<div class="form-group">
<label for="password">Password:</label>
<input type="password" class="form-control" id="password" name="password" ng-model="credentials.password"/>
</div>
<button ng-click="onLogin($event)" type="submit" class="btn btn-primary">Submit</button>
</fieldset>
</form>
Это мои ЯШИ:
$scope.onLogin = function($event){
$event.preventDefault();
$http({
method: 'POST',
url:'/login',
data: $scope.credentials
})
}
Это моя конфигурация безопасности:
@Override
protected void configure(HttpSecurity http) throws Exception {
http
.authorizeRequests()
.antMatchers("/newuser","/create").permitAll()
.antMatchers("/css/**").permitAll()
.antMatchers("/js/**").permitAll()
.antMatchers("/**").hasRole("USER").anyRequest().authenticated()
.and()
.formLogin()
.loginProcessingUrl("/login")
.usernameParameter("username")
.passwordParameter("password")
.defaultSuccessUrl("/index.html")
.loginPage("/loginpage.html")
.and()
.httpBasic()
.and()
.logout()
.logoutUrl("/logout")
.logoutSuccessUrl("/loginpage.html")
.permitAll()
.and()
.csrf().csrfTokenRepository(csrfTokenRepository())
.and()
.addFilterAfter(new CsrfHeaderFilter(), CsrfFilter.class);
}
и это исключение я получаю каждый раз:
org.springframework.security.authentication.InternalAuthenticationServiceException: Cannot pass null or empty values to constructor
Также хотелось бы отметить, что с помощью моего POST имени пользователя и пароля запроса будет отравлены
Я попытался с j_username и j_password, но ничего.
В основном одно из того, что @jaegeg ссылается на нить, на которую он ссылается – jEdgren