spring security get user id from DB

前端 未结 4 2061
南旧
南旧 2021-02-06 16:10

I am using spring security for authentication and successfully able to get User object (org.springframework.security.core.userdetails.User) anywhere I

4条回答
  •  悲&欢浪女
    2021-02-06 16:23

    
      
    
    

    customUserDetailsService will override loadUserByUsername like below

    @Override
    public UserDetails loadUserByUsername(String username) {
    return customUser;
    // where customUser extends org.springframework.security.core.userdetails.User
    }
    

    You can have custom fields under customUser

提交回复
热议问题