public async Task <RosterResponse> FunctionHandler(RosterRequest request, ILambdaContext _) { LambdaLogger.Log($"REQUEST: {request}\r\n"); var response = new RosterResponse(); //if (request.resource == "/convert") //{ // await ConversionHelper.DoConversion("csvjson.turtle_tag.json"); // response.body.message = $"{request.resource} at: {DateTime.Now.ToUniversalTime()}"; // return response; //} var jwt = request.headers["jwt"]; var jwtSecurityTokenHandler = new JwtSecurityTokenHandler(); if (!jwtSecurityTokenHandler.CanReadToken(jwt)) { throw new SecurityTokenValidationException("Unable to read JWT."); } var decodedJwt = jwtSecurityTokenHandler.ReadJwtToken(jwt); var organizationId = Convert.ToString(decodedJwt.Payload["custom:organizationId"]); response.body = request.resource.StartsWith("/reports") ? await HandleReportRequest(organizationId, request) : await HandleDataRequest(organizationId, request); return(response); }
//Event received from the SessionManager when a RosterResponse is received. //When a RosterReponse is received we need to update the tree //Since we're creating new GUI objects, all of that work must //be done on the main thread. We'll go ahead and build the collection //of groups in this background thread and then marshall back over. private void OnIncomingRoster(RosterResponse incomingRosterPacket) { //work performed in here should be done on the main GUI thread //since it will be updating the treeview this.Invoke(new Session.PacketReceivedDelegate(IncomingRosterThreadSafe), new object[] { incomingRosterPacket }); }