example="This is an unique field, and consumers should be aware of it. By convention, WP6 should send the user phone number (i.e. (99)99999-9999).",
required=true
)
@RequestParamStringusername,//
@ApiParam(
name="password",
type="String",
value="password of the user",
example="i.e. P@s5w0rD",
required=true
)
@RequestParamStringpassword
){
returnuserService.login(username,password);
}
@PostMapping("/signup")
@ApiOperation(value="${UserController.signup}")
@ApiOperation(
value="${UserController.signup}",
notes="This the signup method to create new users. By defaul all users are created as inactive. To activate, the method ${UserController.activate} should be invoked."
)
@ApiResponses(value={//
@ApiResponse(code=400,message="Something went wrong"),//
@ApiResponse(code=403,message="Access denied"),//
@ApiResponse(code=422,message="Username is already in use")})
notes="This method is used for role 'ROLE_INSTITUTION'. To activate these users, a key is sent to the EduCemandenOrg e-mail and the user should inform this key to proceed."
)
@ApiResponses(value={//
@ApiResponse(code=400,message="Something went wrong"),//
@ApiResponse(code=403,message="Access denied"),//
@ApiResponse(code=422,message="Username is already in use")})
@ApiResponse(code=422,message="User or ActivationKey registration issues"),//
@ApiResponse(code=500,message="Expired or invalid JWT token")
}
)
publicStringactivate(
@ApiParam(
name="username",
type="String",
value="username of the user",
example="This is an unique field, and consumers should be aware of it. By convention, WP6 should send the user phone number (i.e. (99)99999-9999).",
required=true
)
@RequestParamStringusername,//
@ApiParam(
name="activationkey",
type="String",
value="Activation Key to activate the user",
example="If user belongs to 'ROLE_INSTITUTION' the key should be collected from the emailcemaden, previously sent by ${UserController.sendadminkeybyemailcemaden}. If the user belongs to 'ROLE_CLIENT' the key should be provided by a 'ROLE_INSTITUTION' valid user.",
thrownewCustomException("Something went wrong",HttpStatus.BAD_REQUEST);
}
}
else{
thrownewCustomException("Username is already in use",HttpStatus.UNPROCESSABLE_ENTITY);
}
@ -126,7 +139,12 @@ public class UsersService {
message.setTo(emailcemaden);
message.setSubject("Envio de código para alteração de senha");
message.setText(String.format("Olá! O usuário '%s' solicitou a ativação dele para ADMIN dessa Instituição, por isso você está recebendo esse código: '%s'. Se estiver correto, informe esse código ao solicitante e peça para entrar no aplicativo para prosseguir.",user.getNickname(),uuid));
try{
mailSender.send(message);
}
catch(MailExceptionme){
thrownewCustomException("Something went wrong",HttpStatus.BAD_REQUEST);
x-example:If user belongs to 'ROLE_INSTITUTION' the key should be collected from the emailcemaden, previously sent by ${UserController.sendadminkeybyemailcemaden}. If the user belongs to 'ROLE_CLIENT' the key should be provided by a 'ROLE_INSTITUTION' valid user.
- name:username
in:path
description:Username
required:false
in:query
description:username of the user
required:true
type:string
allowEmptyValue:false
x-example:This is an unique field, and consumers should be aware of it. By convention, WP6 should send the user phone number (i.e. (99)99999-9999).
responses:
'200':
description:OK
@ -243,8 +254,8 @@ paths:
description:Something went wrong
'403':
description:Access denied
'404':
description:The user doesn't exist
'422':
description:User or ActivationKey registration issues
'500':
description:Expired or invalid JWT token
security:
@ -257,6 +268,7 @@ paths:
tags:
- users
summary:${UserController.login}
description:From a valid username and password, this method returns the JWT Token to be used in secure methods.
operationId:loginUsingPOST
consumes:
- application/json
@ -265,16 +277,18 @@ paths:
parameters:
- name:password
in:query
description:Password
required:false
description:password of the user
required:true
type:string
allowEmptyValue:false
x-example:i.e. P@s5w0rD
- name:username
in:query
description:Username
required:false
description:username of the user
required:true
type:string
allowEmptyValue:false
x-example:This is an unique field, and consumers should be aware of it. By convention, WP6 should send the user phone number (i.e. (99)99999-9999).
responses:
'200':
description:OK
@ -282,7 +296,7 @@ paths:
type:string
'400':
description:Something went wrong
'422':
'404':
description:Invalid username/password supplied
security:
- Authorization:
@ -293,6 +307,7 @@ paths:
tags:
- users
summary:${UserController.me}
description:This is the user search method by token.
description:This method is used for role 'ROLE_INSTITUTION'. To activate these users, a key is sent to the EduCemandenOrg e-mail and the user should inform this key to proceed.
operationId:sendadminkeybyemailcemadenUsingPOST
consumes:
- application/json
produces:
- '*/*'
parameters:
- name:emailcemaden
in:query
description:Emailcemaden associated to the user
required:true
type:string
allowEmptyValue:false
x-example:The Cemaden e-mail registred in the database. The key will be sent to this e-mail, and the user should be inform this key to proceed.
- name:username
in:query
description:username of the user
required:true
type:string
allowEmptyValue:false
x-example:This is an unique field, and consumers should be aware of it. By convention, WP6 should send the user phone number (i.e. (99)99999-9999).
responses:
'200':
description:OK
'400':
description:Something went wrong
'403':
description:Access denied
'404':
description:User or Email Cemaden not found
'500':
description:Expired or invalid JWT token
security:
- Authorization:
- global
- apiKey:[]
deprecated:false
/users/signup:
post:
tags:
- users
summary:${UserController.signup}
description:This the signup method to create new users. By defaul all users are created as inactive. To activate, the method ${UserController.activate} should be invoked.
operationId:signupUsingPOST
consumes:
- application/json
@ -343,7 +401,7 @@ paths:
- in:body
name:user
description:Signup User
required:false
required:true
schema:
$ref:'#/definitions/UsersRequestDTO'
responses:
@ -353,10 +411,8 @@ paths:
type:string
'400':
description:Something went wrong
'403':
description:Access denied
'422':
description:Username is already in use
description:Required parameters should be provided
security:
- Authorization:
- global
@ -366,22 +422,23 @@ paths:
tags:
- users
summary:${UserController.search}
description:This is the user search method by username.
operationId:searchUsingGET
produces:
- '*/*'
parameters:
- name:username
in:path
description:Username
required:false
in:query
description:username of the user
required:true
type:string
allowEmptyValue:false
x-example:This is an unique field, and consumers should be aware of it. By convention, WP6 should send the user phone number (i.e. (99)99999-9999).