私は春に認証サービスを作成しています。SpringSecurity UserDetailsServiceパスワードを取得
私はUserDetailsServiceを使用してフォーム変数を取得していますが、loadUserByUsernameには変数userNameが1つしかないことがわかりました。
パスワードの取得方法は?
public class userAuthentication implements UserDetailsService{
private @Autowired
ASPWebServicesUtils aspWebServicesUtils;
@Override
public UserDetails loadUserByUsername(String name) throws UsernameNotFoundException {
//how to get password ?
User user = new User("test", "test", true, true, true, true, getAuthorities(true));
return user;
}
private List<GrantedAuthority> getAuthorities(boolean isAdmin){
List<GrantedAuthority> authorityList = new ArrayList<GrantedAuthority>(2);
authorityList.add(new SimpleGrantedAuthority("USER_ROLE"));
if(isAdmin){
authorityList.add(new SimpleGrantedAuthority("ADMIN_ROLE"));
}
return authorityList;
}
//...
}
おかげ
私は情報を提供webserwiceを持って、ユーザーが存在しています。このwebserwiceにログインとパスワードを渡す必要があります。 – Ilkar
[FAQ](http://static.springsource.org/spring-security/site/faq/faq.html#faq-what-is-userdetailservice)と[documentation](http:// 'UserDetailsService'に何があるのかを確認してください。フレームワークにデータをロードするためだけです。 –