getting error not working in springboot.

getting error not working in springboot.

@RequestMapping(value = "/", method = RequestMethod.GET)

@RequestMapping(value = "/", method = RequestMethod.GET)

@ResponseBody

public ResponseEntity<List<User>> getAllUser(@RequestBody Map<String, String> payload)

{

String username = payload.get("username");

String password = payload.get("password");

User user = repository.findByUsername(username);

if (user != null && user.getPassword().equals(password))

{

Map<String,List <String>> headers=new HashMap<String,List< String>>();

while (repository.findAll()) {


String key = s.next();

return new ResponseEntity<List<User>>(List<User>>,HttpStatus.OK);


}

return new ResponseEntity<List<User>>( HttpStatus.UNAUTHORIZED);


}

this is the code i am not getting how to put authentication so that whenever one user type his username and password which i am having in my database mongodb if the information is valid he can access other rest apis otherwise it should throw invalid authentication.


Angular 9 Tutorial: Learn to Build a CRUD Angular App Quickly

What's new in Bootstrap 5 and when Bootstrap 5 release date?

Brave, Chrome, Firefox, Opera or Edge: Which is Better and Faster?

How to Build Progressive Web Apps (PWA) using Angular 9

What is new features in Javascript ES2020 ECMAScript 2020

Java Fundamentals: Learn Java for absolute beginners |Simpliv

Java Fundamentals: Learn Java for absolute beginners

Java Essentials : Learn Core Java From Basic to Advance

Learn Java Programming Using Practical Assignments. Start Building Back-end Web Applications Robust Test Automation Frameworks By End Of The Course. Learn More!

Fundamentos de Java: Aprende Java desde cero, sin misterios | Simpliv

Fundamentos de Java: Aprende Java desde cero, sin misterios