public async Task <HttpResponseMessage> GetIP() { return(await CreateHttpResponseAsync(Request, async() => { return Request.CreateResponse(HttpStatusCode.OK, "Your IP:" + AuthenticationHandler.GetClientIPAddressHashed(Request)); })); }
public async Task <HttpResponseMessage> Login(string UserID, string Password) { return(await CreateHttpResponseAsync(Request, async() => { string token = string.Empty; if (UserID == "Hassan" && Password == "x") { var model = await Task.Run(() => JWContainerModel.GetJWTContainerModel(UserID, "*****@*****.**", AuthenticationHandler.GetClientIPAddressHashed(Request))); IAuthService authService = new JWTService(model.SecretKey); token = authService.GenerateToken(model); } else { throw new Exception("UserID/Password not valid"); } return Request.CreateResponse(HttpStatusCode.OK, token); })); }