Advertisement
Guest User

Untitled

a guest
Feb 4th, 2025
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.80 KB | None | 0 0
  1. package org.mm.MBlog.security.models;
  2.  
  3. import org.springframework.security.core.userdetails.UserDetails;
  4. import org.springframework.security.core.userdetails.UserDetailsService;
  5. import org.springframework.security.core.userdetails.UsernameNotFoundException;
  6.  
  7. public class CustomUserDetails implements UserDetailsService {
  8.  
  9.     @Override
  10.     public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException {
  11.         // Here you can implement your custom logic to load user details from database or any other source
  12.         // For simplicity, let's create a dummy UserDetails object
  13.         return org.springframework.security.core.userdetails.User.withUsername("username")
  14.                 .password("password")
  15.                 .roles("USER")
  16.                 .build();
  17.     }
  18. }
  19.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement