use of jetbrains.buildServer.serverSide.auth.impl.TwoFactorConfirmationException in project teamcity-rest by JetBrains.
the class TwoFactorRequest method confirmTwoFactor.
@POST
@Path("/confirm")
@ApiOperation(value = "Confirm 2FA secret key", nickname = "confirm2FA")
public void confirmTwoFactor(@QueryParam("uuid") String uuid, @QueryParam("password") int password, @Context HttpServletRequest request) {
if (uuid == null) {
throw new BadRequestException("Missing parameter 'uuid'");
}
try {
myKeysUpdater.confirmCredentials(myUserFinder.getCurrentUser(), UUID.fromString(uuid), password);
// TODO: attempt to prevent instant kick after enabled 2FA without context request
TwoFactorAuthUtil.setTwoFactorCompletion(request);
} catch (TwoFactorConfirmationException e) {
throw new BadRequestException(e.getMessage());
}
}
Aggregations