|
|
|
Spring Security проверка логина
|
|||
|---|---|---|---|
|
#18+
Здравствуйте ! Помогите пожалуйста с проблемой понимания, как реализована проверка логина в Spring Security: Как понимаю я : есть некий сервис : public class AuthenticationService implements IAuthenticationService в котором есть : @Override public boolean login(String username, String password) { log.debug("login ! username = " + username+","+ "password = "+ password); try { Authentication authenticate = authenticationManager .authenticate(new UsernamePasswordAuthenticationToken( username, password)); if (authenticate.isAuthenticated()) { SecurityContextHolder.getContext().setAuthentication( authenticate); return true; } } catch (AuthenticationException e) { } return false; } и есть : public class UsersDetailsService implements UserDetailsService в котором есть public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException { return userManager.getUsrInfoByLoginName(username); } Как понимаю я , что при попытке Authentication authenticate = authenticationManager.authenticate происходит вызов public UserDetails loadUserByUsername(String username) который и возвращает UserDetails , и по данным из UserDetails и происходит собственно логин так ? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 24.12.2013, 10:38 |
|
||
|
Spring Security проверка логина
|
|||
|---|---|---|---|
|
#18+
В общем вопрос то в другом немного: я на этапе userManager.getUsrInfoByLoginName(username); зачитываю пользователя из базы, ну и проверяю перед этим SecurityContextHolder.getContext().getAuthentication().isAuthenticated() и почему то оказывается что она true ! я ничего не понимаю ! почему SecurityContextHolder.getContext().getAuthentication().isAuthenticated() выдает true , когда пользователь еще не прошел авторизацию !? ... |
|||
|
:
Нравится:
Не нравится:
|
|||
| 24.12.2013, 11:07 |
|
||
|
|

start [/forum/topic.php?fid=59&fpage=193&tid=2127922]: |
0ms |
get settings: |
9ms |
get forum list: |
14ms |
check forum access: |
2ms |
check topic access: |
2ms |
track hit: |
196ms |
get topic data: |
11ms |
get forum data: |
3ms |
get page messages: |
32ms |
get tp. blocked users: |
2ms |
| others: | 250ms |
| total: | 521ms |

| 0 / 0 |
