Beispiel #1
0
        public async Task <IActionResult> PostPointsToDevice(string id, [FromBody] TrackingPoint[] points)
        {
            var subject  = ClaimsReader.ReadSubject(this.User);
            var audience = ClaimsReader.ReadAudience(this.User);

            if (audience == JwtAuthConstants.DeviceAudience && id != subject)
            {
                return(Forbid());
            }

            points.ForEach((point) => point.TrackingDeviceId = id);
            var addedPoints = await this.pointService.AddAsync(points);

            await this.geoFenceService.HandlePoints(addedPoints.First().AssetId, addedPoints.ToArray());

            return(Ok());
        }