Login endpoint now return UserDRO
This commit is contained in:
parent
6aa09857f8
commit
40d7aacda2
@ -13,7 +13,6 @@ public class UserDTO {
|
|||||||
private String name;
|
private String name;
|
||||||
private String photo;
|
private String photo;
|
||||||
private String position;
|
private String position;
|
||||||
private LocalDateTime lastVisit;
|
|
||||||
private Set<RoleModel> roles;
|
private Set<RoleModel> roles;
|
||||||
private boolean isActive;
|
private boolean isActive;
|
||||||
private boolean isACSBlocked;
|
private boolean isACSBlocked;
|
||||||
|
@ -2,6 +2,7 @@ package com.displaynone.acss.controllers.auth;
|
|||||||
|
|
||||||
import com.displaynone.acss.components.auth.AuthComponent;
|
import com.displaynone.acss.components.auth.AuthComponent;
|
||||||
import com.displaynone.acss.components.auth.models.AuthTokenPair;
|
import com.displaynone.acss.components.auth.models.AuthTokenPair;
|
||||||
|
import com.displaynone.acss.components.auth.models.user.UserMapper;
|
||||||
import com.displaynone.acss.components.auth.models.user.UserModel;
|
import com.displaynone.acss.components.auth.models.user.UserModel;
|
||||||
import com.displaynone.acss.exception.generics.BadRequestHTTPException;
|
import com.displaynone.acss.exception.generics.BadRequestHTTPException;
|
||||||
import com.displaynone.acss.exception.generics.NotFoundHTTPException;
|
import com.displaynone.acss.exception.generics.NotFoundHTTPException;
|
||||||
@ -21,7 +22,7 @@ public class AuthController {
|
|||||||
private final AuthComponent authComponent;
|
private final AuthComponent authComponent;
|
||||||
|
|
||||||
@PostMapping("/login")
|
@PostMapping("/login")
|
||||||
public ResponseEntity<AuthTokenPair> login(@RequestBody LoginRQB body) {
|
public ResponseEntity<LoginRSB> login(@RequestBody LoginRQB body) {
|
||||||
String login = body.getLogin();
|
String login = body.getLogin();
|
||||||
String password = body.getPassword();
|
String password = body.getPassword();
|
||||||
|
|
||||||
@ -35,7 +36,7 @@ public class AuthController {
|
|||||||
throw new UnauthorizedHTTPException(e.getMessage());
|
throw new UnauthorizedHTTPException(e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
return ResponseEntity.ok(authInfo.getSecond());
|
return ResponseEntity.ok(new LoginRSB(UserMapper.convertToDTO(authInfo.getFirst()), authInfo.getSecond()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/refresh")
|
@PostMapping("/refresh")
|
||||||
|
@ -0,0 +1,13 @@
|
|||||||
|
package com.displaynone.acss.controllers.auth;
|
||||||
|
|
||||||
|
import com.displaynone.acss.components.auth.models.AuthTokenPair;
|
||||||
|
import com.displaynone.acss.components.auth.models.user.UserDTO;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class LoginRSB {
|
||||||
|
private UserDTO user;
|
||||||
|
private AuthTokenPair tokens;
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user