SpringSecurity自定义用户认证逻辑

⒈处理用户信息获取逻辑

  用户信息的获取逻辑是被SpringSecurity封装到UserDetailsService接口里面的

 1 package org.springframework.security.core.userdetails;
 2 
 3 /**
 4  * 用户信息的获取逻辑是被SpringSecurity封装到UserDetailsService接口里面的
 5  */
 6 public interface UserDetailsService {
 7 
 8     /**
 9      * 根据通过用户输入的用户名得到用户信息,SpringSecurity会利用这些用户信息去做一些相应的处理和校验。
10      * 如果处理和检验都通过了,Spring会把这个用户放到Session里面。
11      * 如果找不到用户,则会抛出用户名不存在这个异常
12      * @param username
13      * @return
14      * @throws UsernameNotFoundException
15      */
16     UserDetails loadUserByUsername(String username) throws UsernameNotFoundException;
17 }

猜你喜欢

转载自www.cnblogs.com/fanqisoft/p/10616845.html