I am totally new on security topic and fetch api so maybe it is a dumb question but I do not know that where to start. I have checked some examples but I could not find a proper way to modify both frontend and backend side. I am using fetch api on frontend api but I am just sending simple request for login but both mail and password is visible on request. My fetch api code is just a simple post request:
export class User {
userId: number;
email: string;
username: string;
password: string;
constructor() {
}
}
registerUser(user: User) {
return fetch("http://localhost:8080/registerUser", {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json'
},
method: 'POST',
body: JSON.stringify(user)
});
}
It is just a simple post request and all parameters are visible and I am consuming this on spring with method:
@PostMapping("/registerUser")
public UserDto registerUser(@RequestBody UserDto userDto) throws UserAlreadyExistException {
if (!isNull(userService.getUserByUsername(userDto))) {
throw new UserAlreadyExistException("User with username " + userDto.getUsername() + "already exist");
}
User userObj;
userObj = userService.saveUser(modelMapper.map(userDto, User.class));
return modelMapper.map(userObj, UserDto.class);
}
How can I modify them or where should I start to check?