Browse Source

Fixing login issue

main
ddangelorb 3 years ago
parent
commit
e811f3a9d0
  1. 10
      src/main/java/org/waterproofingdata/wpdauth/controller/UsersController.java
  2. 2
      src/main/java/org/waterproofingdata/wpdauth/dto/UsersResponseDTO.java
  3. 2
      src/main/java/org/waterproofingdata/wpdauth/security/WebSecurityConfig.java

10
src/main/java/org/waterproofingdata/wpdauth/controller/UsersController.java

@ -35,7 +35,7 @@ public class UsersController {
private ModelMapper modelMapper; private ModelMapper modelMapper;
@PostMapping("/login") @PostMapping("/login")
@ApiOperation(value = "${UserController.signin}")
@ApiOperation(value = "${UserController.login}")
@ApiResponses(value = {// @ApiResponses(value = {//
@ApiResponse(code = 400, message = "Something went wrong"), // @ApiResponse(code = 400, message = "Something went wrong"), //
@ApiResponse(code = 422, message = "Invalid username/password supplied")}) @ApiResponse(code = 422, message = "Invalid username/password supplied")})
@ -78,8 +78,8 @@ public class UsersController {
@ApiResponse(code = 500, message = "Expired or invalid JWT token")}) @ApiResponse(code = 500, message = "Expired or invalid JWT token")})
public UsersResponseDTO search(@ApiParam("Username") @PathVariable String username) { public UsersResponseDTO search(@ApiParam("Username") @PathVariable String username) {
UsersResponseDTO urDTO = modelMapper.map(userService.search(username), UsersResponseDTO.class); UsersResponseDTO urDTO = modelMapper.map(userService.search(username), UsersResponseDTO.class);
urDTO.setEduCemadenOrganization(userService.findEduCemadenOrganizationById(urDTO.getId()));
urDTO.setRolesProviderActivationKeys(userService.findRolesproviderActivationKeysById(urDTO.getId()));
//urDTO.setEduCemadenOrganization(userService.findEduCemadenOrganizationById(urDTO.getId()));
//urDTO.setRolesProviderActivationKeys(userService.findRolesproviderActivationKeysById(urDTO.getId()));
return urDTO; return urDTO;
} }
@ -92,8 +92,8 @@ public class UsersController {
@ApiResponse(code = 500, message = "Expired or invalid JWT token")}) @ApiResponse(code = 500, message = "Expired or invalid JWT token")})
public UsersResponseDTO whoami(HttpServletRequest req) { public UsersResponseDTO whoami(HttpServletRequest req) {
UsersResponseDTO urDTO = modelMapper.map(userService.whoami(req), UsersResponseDTO.class); UsersResponseDTO urDTO = modelMapper.map(userService.whoami(req), UsersResponseDTO.class);
urDTO.setEduCemadenOrganization(userService.findEduCemadenOrganizationById(urDTO.getId()));
urDTO.setRolesProviderActivationKeys(userService.findRolesproviderActivationKeysById(urDTO.getId()));
//urDTO.setEduCemadenOrganization(userService.findEduCemadenOrganizationById(urDTO.getId()));
//urDTO.setRolesProviderActivationKeys(userService.findRolesproviderActivationKeysById(urDTO.getId()));
return urDTO; return urDTO;
} }

2
src/main/java/org/waterproofingdata/wpdauth/dto/UsersResponseDTO.java

@ -22,9 +22,11 @@ public class UsersResponseDTO {
@ApiModelProperty(position = 2) @ApiModelProperty(position = 2)
List<Roles> roles; List<Roles> roles;
/*
@ApiModelProperty(position = 3) @ApiModelProperty(position = 3)
EduCemadenOrganizations eduCemadenOrganization; EduCemadenOrganizations eduCemadenOrganization;
@ApiModelProperty(position = 4) @ApiModelProperty(position = 4)
List<UsersRolesproviderActivationKey> rolesProviderActivationKeys; List<UsersRolesproviderActivationKey> rolesProviderActivationKeys;
*/
} }

2
src/main/java/org/waterproofingdata/wpdauth/security/WebSecurityConfig.java

@ -33,7 +33,7 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
// Entry points // Entry points
http.authorizeRequests()// http.authorizeRequests()//
.antMatchers("/users/signin").permitAll()//
.antMatchers("/users/login").permitAll()//
.antMatchers("/users/signup").permitAll()// .antMatchers("/users/signup").permitAll()//
.antMatchers("/h2-console/**/**").permitAll() .antMatchers("/h2-console/**/**").permitAll()
// Disallow everything else.. // Disallow everything else..

Loading…
Cancel
Save