parent
b7120acfad
commit
bfb333d57f
|
@ -18,15 +18,12 @@ public class UserController {
|
|||
|
||||
@RequestMapping("/login")
|
||||
public boolean login(@RequestBody User user) {
|
||||
if(user.getUserName().equals("user") && user.getPassword().equals("password")) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
return user.getUserName().equals("user") && user.getPassword().equals("password");
|
||||
}
|
||||
|
||||
|
||||
@RequestMapping("/user")
|
||||
public Principal user(HttpServletRequest request) {
|
||||
String authToken = request.getHeader("Authorization").substring("Basic".length()).trim();
|
||||
return () -> new String(Base64.getDecoder().decode(authToken)).split(":")[0];
|
||||
return () -> new String(Base64.getDecoder().decode(authToken)).split(":")[0];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue