public static async Task <IActionResult> HttpExtensionsJwtAuth2( [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = null)] HttpRequest req, [HttpToken] HttpUser user, ILogger log) { return(new OkResult()); }
public static async Task <IActionResult> UserData( [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = "userdata")] HttpRequest req, [HttpToken] HttpUser user, ILogger log) { return(new OkObjectResult(new MyUser() { Id = user.ClaimsPrincipal.Identity.Name, NickName = user.ClaimsPrincipal.Claims.First(x => x.Type == "nickname").Value })); }
public static async Task <IActionResult> HttpExtensionsJwtAuth1( [HttpTrigger(AuthorizationLevel.Anonymous, "get", Route = null)] HttpRequest req, [HttpToken] HttpUser user, ILogger log) { return(new OkObjectResult(new { user = user.ClaimsPrincipal.Identity.Name })); }
public async Task <IActionResult> Send(string username, string message) { var user = new HttpUser { Ip = LocalIp, Username = username, Message = message }; var f = new FormUrlEncodedContent(user.ToDictionary()); foreach (var clientIp in ClientsIps) { await Client.PostAsync("http://localhost:5000/Home/Store/", f); } return(Json("Sent")); }
public void Store(HttpUser infos) { HttpContext.Session.SetObjectAsJson($"infos.Username", infos); }