diff --git a/.vs/MyCore/v15/Server/sqlite3/storage.ide b/.vs/MyCore/v15/Server/sqlite3/storage.ide index 50d6ba2..cb961c9 100644 Binary files a/.vs/MyCore/v15/Server/sqlite3/storage.ide and b/.vs/MyCore/v15/Server/sqlite3/storage.ide differ diff --git a/.vs/MyCore/v15/Server/sqlite3/storage.ide-shm b/.vs/MyCore/v15/Server/sqlite3/storage.ide-shm index 7598333..9e8da61 100644 Binary files a/.vs/MyCore/v15/Server/sqlite3/storage.ide-shm and b/.vs/MyCore/v15/Server/sqlite3/storage.ide-shm differ diff --git a/.vs/MyCore/v15/Server/sqlite3/storage.ide-wal b/.vs/MyCore/v15/Server/sqlite3/storage.ide-wal index 17861aa..9d5ea97 100644 Binary files a/.vs/MyCore/v15/Server/sqlite3/storage.ide-wal and b/.vs/MyCore/v15/Server/sqlite3/storage.ide-wal differ diff --git a/MyCore/Controllers/IOTController.cs b/MyCore/Controllers/IOTController.cs index 40099d8..0a2604f 100644 --- a/MyCore/Controllers/IOTController.cs +++ b/MyCore/Controllers/IOTController.cs @@ -14,7 +14,7 @@ namespace MyCore.Controllers [Authorize(Roles = "Admin")] [Route("api/iot")] [ApiController] - public class IOTController : Controller + public class IOTController : ControllerBase { private readonly IoTDeviceService _ioTDeviceService; diff --git a/MyCore/Controllers/TokenController.cs b/MyCore/Controllers/TokenController.cs index 6ade3a4..e4fe458 100644 --- a/MyCore/Controllers/TokenController.cs +++ b/MyCore/Controllers/TokenController.cs @@ -3,12 +3,14 @@ using System.Collections.Generic; using System.IdentityModel.Tokens.Jwt; using System.Linq; using System.Security.Claims; +using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Mvc; using Microsoft.IdentityModel.Tokens; +using MyCore.Models; namespace MyCore.Controllers { @@ -20,10 +22,20 @@ namespace MyCore.Controllers [AllowAnonymous] [HttpPost] - public IActionResult Create(string username, string password) + public ActionResult Create(string username, string password) { + var test = GenerateSHA256String(password); + if (IsValidUserAndPasswordCombination(username, password)) - return new ObjectResult("{\"Token\":\""+GenerateToken(username)+"\"}"); + { + UserInfo user = new UserInfo(); + user.FirstName = "Thomas"; + user.LastName = "Fransolet"; + user.Token = GenerateToken(username).ToString(); + + return user; + } + //return new ObjectResult("{\"Token\":\""+GenerateToken(username)+"\"}"); return BadRequest(); } @@ -56,5 +68,24 @@ namespace MyCore.Controllers if (username == "Thomas" && password == "MonsieurMagic") { return true; } else return false; } + + public static string GenerateSHA256String(string inputString) + { + SHA256 sha256 = SHA256Managed.Create(); + byte[] bytes = Encoding.UTF8.GetBytes(inputString); + byte[] hash = sha256.ComputeHash(bytes); + return GetStringFromHash(hash); + } + + private static string GetStringFromHash(byte[] hash) + { + StringBuilder result = new StringBuilder(); + for (int i = 0; i < hash.Length; i++) + { + result.Append(hash[i].ToString("X2")); + } + return result.ToString(); + } + } } \ No newline at end of file diff --git a/MyCore/Controllers/UserController.cs b/MyCore/Controllers/UserController.cs new file mode 100644 index 0000000..2626746 --- /dev/null +++ b/MyCore/Controllers/UserController.cs @@ -0,0 +1,77 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using MQTTnet; +using MQTTnet.Client; +using MQTTnet.Server; +using MyCore.Models; +using MyCore.Services; + +namespace MyCore.Controllers +{ + [Authorize(Roles = "Admin")] + [Route("api/user")] + [ApiController] + public class UserController : ControllerBase + { + private readonly UserService _userService; + + public UserController(UserService userService) + { + _userService = userService; + } + + // GET api/user + /// + /// Get a list of user + /// + [HttpGet] + public ActionResult> Get() + { + //return new string[] { "value1", "value2" }; + //return _userService.GetUsers(); + return null; + } + + + // GET api/user/5 + /// + /// Get a specific user + /// + /// id user + [HttpGet("{id}")] + public ActionResult Get(string id) + { + UserInfo user = new UserInfo(); + user.FirstName = "Thomas"; + user.Id = "01"; + return user; + //return _userService.GetUser(id); + + } + /* + // POST api/values + [HttpPost] + public void Post([FromBody] string value) + { + // For more information on protecting this API from Cross Site Request Forgery (CSRF) attacks, see https://go.microsoft.com/fwlink/?LinkID=717803 + } + + // PUT api/values/5 + [HttpPut("{id}")] + public void Put(int id, [FromBody] string value) + { + // For more information on protecting this API from Cross Site Request Forgery (CSRF) attacks, see https://go.microsoft.com/fwlink/?LinkID=717803 + } + + // DELETE api/values/5 + [HttpDelete("{id}")] + public void Delete(int id) + { + // For more information on protecting this API from Cross Site Request Forgery (CSRF) attacks, see https://go.microsoft.com/fwlink/?LinkID=717803 + }*/ + } +} diff --git a/MyCore/Models/UserInfo.cs b/MyCore/Models/UserInfo.cs new file mode 100644 index 0000000..eae1223 --- /dev/null +++ b/MyCore/Models/UserInfo.cs @@ -0,0 +1,41 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using AspNetCore.Security.Jwt; +using MongoDB.Bson; +using MongoDB.Bson.Serialization.Attributes; + +namespace MyCore.Models +{ + public class UserInfo : IAuthenticationUser + { + [BsonId] + [BsonRepresentation(BsonType.ObjectId)] + public string Id { get; set; } + + [BsonElement("Role")] + public string Role { get; set; } + + [BsonElement("Username")] + public string Username { get; set; } + + [BsonElement("Password")] + public string Password { get; set; } + + [BsonElement("FirstName")] + public string FirstName { get; set; } + + [BsonElement("LastName")] + public string LastName { get; set; } + + [BsonElement("Token")] + public string Token { get; set; } + + [BsonElement("Birthday")] + public string Birthday { get; set; } + } +} + + + \ No newline at end of file diff --git a/MyCore/Models/UserModel.cs b/MyCore/Models/UserModel.cs deleted file mode 100644 index 1542481..0000000 --- a/MyCore/Models/UserModel.cs +++ /dev/null @@ -1,23 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using AspNetCore.Security.Jwt; - - -namespace MyCore.Models -{ - public class UserModel : IAuthenticationUser - { - public string Id { get; set; } - - public string Password { get; set; } - - public string Role { get; set; } - - public DateTime DOB { get; set; } - } -} - - - \ No newline at end of file diff --git a/MyCore/Services/UserService.cs b/MyCore/Services/UserService.cs new file mode 100644 index 0000000..a283172 --- /dev/null +++ b/MyCore/Services/UserService.cs @@ -0,0 +1,54 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using System.Collections.Generic; +using System.Linq; +using MyCore.Models; +using Microsoft.Extensions.Configuration; +using MongoDB.Driver; + +namespace MyCore.Services +{ + public class UserService + { + private readonly IMongoCollection _Users; + + public UserService(IConfiguration config) + { + var client = new MongoClient(config.GetConnectionString("MyCoreDb")); + var database = client.GetDatabase("MyCoreDb"); + _Users = database.GetCollection("Users"); + } + public List GetUsers() + { + return _Users.Find(m => true).ToList(); + } + + public UserInfo GetUser(string id) + { + return _Users.Find(m => m.Id == id).FirstOrDefault(); + } + + public UserInfo CreateUser(UserInfo user) + { + _Users.InsertOne(user); + return user; + } + + /*public void Update(string id, Book bookIn) + { + _books.ReplaceOne(book => book.Id == id, bookIn); + } + + public void Remove(Book bookIn) + { + _books.DeleteOne(book => book.Id == bookIn.Id); + } + + public void Remove(string id) + { + _books.DeleteOne(book => book.Id == id); + }*/ + } +} diff --git a/MyCore/Startup.cs b/MyCore/Startup.cs index 1e84531..169464d 100644 --- a/MyCore/Startup.cs +++ b/MyCore/Startup.cs @@ -85,7 +85,7 @@ namespace MyCore { app.UseCors( - options => options.WithOrigins("http://localhost:4200").AllowAnyMethod() + options => options.WithOrigins("http://localhost:4200").AllowAnyMethod().AllowAnyHeader() ); // Enable middleware to serve generated Swagger as a JSON endpoint. diff --git a/MyCore/bin/Debug/netcoreapp2.1/MyCore.xml b/MyCore/bin/Debug/netcoreapp2.1/MyCore.xml index 5507925..7ed8608 100644 --- a/MyCore/bin/Debug/netcoreapp2.1/MyCore.xml +++ b/MyCore/bin/Debug/netcoreapp2.1/MyCore.xml @@ -29,6 +29,17 @@ It's a mqtt publish test ! :) + + + Get a list of user + + + + + Get a specific user + + id user + It's a test ! :) diff --git a/MyCore/obj/Debug/netcoreapp2.1/MyCore.xml b/MyCore/obj/Debug/netcoreapp2.1/MyCore.xml index 5507925..7ed8608 100644 --- a/MyCore/obj/Debug/netcoreapp2.1/MyCore.xml +++ b/MyCore/obj/Debug/netcoreapp2.1/MyCore.xml @@ -29,6 +29,17 @@ It's a mqtt publish test ! :) + + + Get a list of user + + + + + Get a specific user + + id user + It's a test ! :) diff --git a/swagger.json b/swagger.json index 2bfdff3..abe177a 100644 --- a/swagger.json +++ b/swagger.json @@ -1 +1 @@ -{"swagger":"2.0","info":{"version":"v1","title":"MyCoreApi"},"paths":{"/azure":{"post":{"tags":["Azure"],"operationId":"Create","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":["application/json"],"parameters":[{"name":"user","in":"body","required":false,"schema":{"$ref":"#/definitions/AzureADAuthModel"}}],"responses":{"200":{"description":"Success"}}}},"/api/books":{"get":{"tags":["Books"],"operationId":"Get","consumes":[],"produces":["text/plain","application/json","text/json"],"parameters":[],"responses":{"200":{"description":"Success","schema":{"uniqueItems":false,"type":"array","items":{"$ref":"#/definitions/Book"}}}}},"post":{"tags":["Books"],"operationId":"Create","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":["text/plain","application/json","text/json"],"parameters":[{"name":"book","in":"body","required":false,"schema":{"$ref":"#/definitions/Book"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/Book"}}}}},"/api/books/{id}":{"get":{"tags":["Books"],"operationId":"GetBook","consumes":[],"produces":["text/plain","application/json","text/json"],"parameters":[{"name":"id","in":"path","required":true,"type":"string"}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/Book"}}}},"put":{"tags":["Books"],"operationId":"Update","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":[],"parameters":[{"name":"id","in":"path","required":true,"type":"string"},{"name":"bookIn","in":"body","required":false,"schema":{"$ref":"#/definitions/Book"}}],"responses":{"200":{"description":"Success"}}},"delete":{"tags":["Books"],"operationId":"Delete","consumes":[],"produces":[],"parameters":[{"name":"id","in":"path","required":true,"type":"string"}],"responses":{"200":{"description":"Success"}}}},"/facebook":{"post":{"tags":["Facebook"],"operationId":"Create","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":["application/json"],"parameters":[{"name":"user","in":"body","required":false,"schema":{"$ref":"#/definitions/FacebookAuthModel"}}],"responses":{"200":{"description":"Success"}}}},"/google":{"post":{"tags":["Google"],"operationId":"Create","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":["application/json"],"parameters":[{"name":"user","in":"body","required":false,"schema":{"$ref":"#/definitions/GoogleAuthModel"}}],"responses":{"200":{"description":"Success"}}}},"/api/iot/smartprinter/{idDevice}":{"get":{"tags":["IOT"],"summary":"Retrieve all SmartPrinterMessage","operationId":"GetSmartPrinterMessages","consumes":[],"produces":["text/plain","application/json","text/json"],"parameters":[{"name":"id","in":"query","description":"Id of the smart printer message","required":false,"type":"integer","format":"int32"},{"name":"idDevice","in":"path","required":true,"type":"string"}],"responses":{"200":{"description":"Success","schema":{"uniqueItems":false,"type":"array","items":{"$ref":"#/definitions/SmartPrinterMessage"}}}}},"post":{"tags":["IOT"],"summary":"It's the method to post data from mqtt broker to Database (Thanks Rpi!)","operationId":"PostToDBPrinter","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":[],"parameters":[{"name":"idDevice","in":"path","description":"Id of the device to upload to DB","required":true,"type":"integer","format":"int32"},{"name":"content","in":"body","description":"Content that will be uploaded","required":false,"schema":{"uniqueItems":false,"type":"array","items":{"$ref":"#/definitions/SmartPrinterMessage"}}}],"responses":{"200":{"description":"Success"},"201":{"description":"Content successfully posted to DB"},"500":{"description":"Unexpected error"}}}},"/api/iot/smartgarden/{idDevice}":{"post":{"tags":["IOT"],"summary":"It's the method to post data from mqtt broker to Database (Thanks Rpi!)","operationId":"PostToDBSmartGarden","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":[],"parameters":[{"name":"idDevice","in":"path","required":true,"type":"integer","format":"int32"},{"name":"content","in":"body","required":false,"schema":{"uniqueItems":false,"type":"array","items":{"$ref":"#/definitions/SmartGardenMessage"}}}],"responses":{"200":{"description":"Success"}}}},"/api/mqtt":{"get":{"tags":["MQTT"],"summary":"It's a mqtt publish test ! :)","operationId":"GetToPublishMqtt","consumes":[],"produces":[],"parameters":[],"responses":{"200":{"description":"Success"}}}},"/api/token":{"post":{"tags":["Token"],"operationId":"Create","consumes":[],"produces":[],"parameters":[{"name":"username","in":"query","required":false,"type":"string"},{"name":"password","in":"query","required":false,"type":"string"}],"responses":{"200":{"description":"Success"}}}},"/token":{"post":{"tags":["Token"],"operationId":"Create","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":["application/json"],"parameters":[{"name":"user","in":"body","required":false,"schema":{"$ref":"#/definitions/User"}}],"responses":{"200":{"description":"Success"}}}},"/twitter":{"post":{"tags":["Twitter"],"operationId":"Create","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":["application/json"],"parameters":[{"name":"user","in":"body","required":false,"schema":{"$ref":"#/definitions/TwitterAuthModel"}}],"responses":{"200":{"description":"Success"}}}},"/api/test":{"get":{"tags":["Values"],"summary":"It's a test ! :)","operationId":"Get","consumes":[],"produces":["text/plain","application/json","text/json"],"parameters":[],"responses":{"200":{"description":"Success","schema":{"uniqueItems":false,"type":"array","items":{"type":"string"}}}}},"post":{"tags":["Values"],"operationId":"Post","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":[],"parameters":[{"name":"value","in":"body","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success"}}}},"/api/test/{id}":{"get":{"tags":["Values"],"operationId":"Get","consumes":[],"produces":["text/plain","application/json","text/json"],"parameters":[{"name":"id","in":"path","required":true,"type":"integer","format":"int32"}],"responses":{"200":{"description":"Success","schema":{"type":"string"}}}},"put":{"tags":["Values"],"operationId":"Put","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":[],"parameters":[{"name":"id","in":"path","required":true,"type":"integer","format":"int32"},{"name":"value","in":"body","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success"}}},"delete":{"tags":["Values"],"operationId":"Delete","consumes":[],"produces":[],"parameters":[{"name":"id","in":"path","required":true,"type":"integer","format":"int32"}],"responses":{"200":{"description":"Success"}}}}},"definitions":{"AzureADAuthModel":{"type":"object","properties":{"apiKey":{"type":"string"}}},"Book":{"type":"object","properties":{"id":{"type":"string"},"bookName":{"type":"string"},"price":{"format":"double","type":"number"},"category":{"type":"string"},"author":{"type":"string"}}},"FacebookAuthModel":{"type":"object","properties":{"userAccessToken":{"type":"string"}}},"GoogleAuthModel":{"type":"object","properties":{"authorizationCode":{"type":"string"},"apiKey":{"type":"string"}}},"SmartPrinterMessage":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"time":{"type":"string"},"temperature":{"format":"double","type":"number"},"pressure":{"format":"double","type":"number"},"smoke":{"format":"int32","type":"integer"}}},"SmartGardenMessage":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"time":{"type":"string"},"temperature":{"format":"double","type":"number"},"pressure":{"format":"double","type":"number"},"humidity":{"format":"double","type":"number"},"water":{"format":"int32","type":"integer"},"light":{"format":"int32","type":"integer"}}},"User":{"type":"object","properties":{"id":{"type":"string"},"password":{"type":"string"}}},"TwitterAuthModel":{"type":"object","properties":{"apiKey":{"type":"string"}}}},"securityDefinitions":{"Bearer":{"name":"Authorization","in":"header","type":"apiKey","description":"Please enter JWT with Bearer into field"}},"security":[{"Bearer":[]}]} \ No newline at end of file +{"swagger":"2.0","info":{"version":"v1","title":"MyCoreApi"},"paths":{"/azure":{"post":{"tags":["Azure"],"operationId":"Create","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":["application/json"],"parameters":[{"name":"user","in":"body","required":false,"schema":{"$ref":"#/definitions/AzureADAuthModel"}}],"responses":{"200":{"description":"Success"}}}},"/api/books":{"get":{"tags":["Books"],"operationId":"Get","consumes":[],"produces":["text/plain","application/json","text/json"],"parameters":[],"responses":{"200":{"description":"Success","schema":{"uniqueItems":false,"type":"array","items":{"$ref":"#/definitions/Book"}}}}},"post":{"tags":["Books"],"operationId":"Create","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":["text/plain","application/json","text/json"],"parameters":[{"name":"book","in":"body","required":false,"schema":{"$ref":"#/definitions/Book"}}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/Book"}}}}},"/api/books/{id}":{"get":{"tags":["Books"],"operationId":"GetBook","consumes":[],"produces":["text/plain","application/json","text/json"],"parameters":[{"name":"id","in":"path","required":true,"type":"string"}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/Book"}}}},"put":{"tags":["Books"],"operationId":"Update","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":[],"parameters":[{"name":"id","in":"path","required":true,"type":"string"},{"name":"bookIn","in":"body","required":false,"schema":{"$ref":"#/definitions/Book"}}],"responses":{"200":{"description":"Success"}}},"delete":{"tags":["Books"],"operationId":"Delete","consumes":[],"produces":[],"parameters":[{"name":"id","in":"path","required":true,"type":"string"}],"responses":{"200":{"description":"Success"}}}},"/facebook":{"post":{"tags":["Facebook"],"operationId":"Create","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":["application/json"],"parameters":[{"name":"user","in":"body","required":false,"schema":{"$ref":"#/definitions/FacebookAuthModel"}}],"responses":{"200":{"description":"Success"}}}},"/google":{"post":{"tags":["Google"],"operationId":"Create","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":["application/json"],"parameters":[{"name":"user","in":"body","required":false,"schema":{"$ref":"#/definitions/GoogleAuthModel"}}],"responses":{"200":{"description":"Success"}}}},"/api/iot/smartprinter/{idDevice}":{"get":{"tags":["IOT"],"summary":"Retrieve all SmartPrinterMessage","operationId":"GetSmartPrinterMessages","consumes":[],"produces":["text/plain","application/json","text/json"],"parameters":[{"name":"id","in":"query","description":"Id of the smart printer message","required":false,"type":"integer","format":"int32"},{"name":"idDevice","in":"path","required":true,"type":"string"}],"responses":{"200":{"description":"Success","schema":{"uniqueItems":false,"type":"array","items":{"$ref":"#/definitions/SmartPrinterMessage"}}}}},"post":{"tags":["IOT"],"summary":"It's the method to post data from mqtt broker to Database (Thanks Rpi!)","operationId":"PostToDBPrinter","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":[],"parameters":[{"name":"idDevice","in":"path","description":"Id of the device to upload to DB","required":true,"type":"integer","format":"int32"},{"name":"content","in":"body","description":"Content that will be uploaded","required":false,"schema":{"uniqueItems":false,"type":"array","items":{"$ref":"#/definitions/SmartPrinterMessage"}}}],"responses":{"200":{"description":"Success"},"201":{"description":"Content successfully posted to DB"},"500":{"description":"Unexpected error"}}}},"/api/iot/smartgarden/{idDevice}":{"post":{"tags":["IOT"],"summary":"It's the method to post data from mqtt broker to Database (Thanks Rpi!)","operationId":"PostToDBSmartGarden","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":[],"parameters":[{"name":"idDevice","in":"path","required":true,"type":"integer","format":"int32"},{"name":"content","in":"body","required":false,"schema":{"uniqueItems":false,"type":"array","items":{"$ref":"#/definitions/SmartGardenMessage"}}}],"responses":{"200":{"description":"Success"}}}},"/api/mqtt":{"get":{"tags":["MQTT"],"summary":"It's a mqtt publish test ! :)","operationId":"GetToPublishMqtt","consumes":[],"produces":[],"parameters":[],"responses":{"200":{"description":"Success"}}}},"/api/token":{"post":{"tags":["Token"],"operationId":"Create","consumes":[],"produces":[],"parameters":[{"name":"username","in":"query","required":false,"type":"string"},{"name":"password","in":"query","required":false,"type":"string"}],"responses":{"200":{"description":"Success"}}}},"/token":{"post":{"tags":["Token"],"operationId":"Create","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":["application/json"],"parameters":[{"name":"user","in":"body","required":false,"schema":{"$ref":"#/definitions/User"}}],"responses":{"200":{"description":"Success"}}}},"/twitter":{"post":{"tags":["Twitter"],"operationId":"Create","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":["application/json"],"parameters":[{"name":"user","in":"body","required":false,"schema":{"$ref":"#/definitions/TwitterAuthModel"}}],"responses":{"200":{"description":"Success"}}}},"/api/user":{"get":{"tags":["User"],"summary":"Get a list of user","operationId":"Get","consumes":[],"produces":["text/plain","application/json","text/json"],"parameters":[],"responses":{"200":{"description":"Success","schema":{"uniqueItems":false,"type":"array","items":{"$ref":"#/definitions/UserInfo"}}}}}},"/api/user/{id}":{"get":{"tags":["User"],"summary":"Get a specific user","operationId":"Get","consumes":[],"produces":["text/plain","application/json","text/json"],"parameters":[{"name":"id","in":"path","description":"id user","required":true,"type":"string"}],"responses":{"200":{"description":"Success","schema":{"$ref":"#/definitions/UserInfo"}}}}},"/api/test":{"get":{"tags":["Values"],"summary":"It's a test ! :)","operationId":"Get","consumes":[],"produces":["text/plain","application/json","text/json"],"parameters":[],"responses":{"200":{"description":"Success","schema":{"uniqueItems":false,"type":"array","items":{"type":"string"}}}}},"post":{"tags":["Values"],"operationId":"Post","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":[],"parameters":[{"name":"value","in":"body","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success"}}}},"/api/test/{id}":{"get":{"tags":["Values"],"operationId":"Get","consumes":[],"produces":["text/plain","application/json","text/json"],"parameters":[{"name":"id","in":"path","required":true,"type":"integer","format":"int32"}],"responses":{"200":{"description":"Success","schema":{"type":"string"}}}},"put":{"tags":["Values"],"operationId":"Put","consumes":["application/json-patch+json","application/json","text/json","application/*+json"],"produces":[],"parameters":[{"name":"id","in":"path","required":true,"type":"integer","format":"int32"},{"name":"value","in":"body","required":false,"schema":{"type":"string"}}],"responses":{"200":{"description":"Success"}}},"delete":{"tags":["Values"],"operationId":"Delete","consumes":[],"produces":[],"parameters":[{"name":"id","in":"path","required":true,"type":"integer","format":"int32"}],"responses":{"200":{"description":"Success"}}}}},"definitions":{"AzureADAuthModel":{"type":"object","properties":{"apiKey":{"type":"string"}}},"Book":{"type":"object","properties":{"id":{"type":"string"},"bookName":{"type":"string"},"price":{"format":"double","type":"number"},"category":{"type":"string"},"author":{"type":"string"}}},"FacebookAuthModel":{"type":"object","properties":{"userAccessToken":{"type":"string"}}},"GoogleAuthModel":{"type":"object","properties":{"authorizationCode":{"type":"string"},"apiKey":{"type":"string"}}},"SmartPrinterMessage":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"time":{"type":"string"},"temperature":{"format":"double","type":"number"},"pressure":{"format":"double","type":"number"},"smoke":{"format":"int32","type":"integer"}}},"SmartGardenMessage":{"type":"object","properties":{"id":{"type":"string"},"type":{"type":"string"},"time":{"type":"string"},"temperature":{"format":"double","type":"number"},"pressure":{"format":"double","type":"number"},"humidity":{"format":"double","type":"number"},"water":{"format":"int32","type":"integer"},"light":{"format":"int32","type":"integer"}}},"User":{"type":"object","properties":{"id":{"type":"string"},"password":{"type":"string"}}},"TwitterAuthModel":{"type":"object","properties":{"apiKey":{"type":"string"}}},"UserInfo":{"type":"object","properties":{"id":{"type":"string"},"role":{"type":"string"},"username":{"type":"string"},"password":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":"string"},"token":{"type":"string"},"birthday":{"type":"string"}}}},"securityDefinitions":{"Bearer":{"name":"Authorization","in":"header","type":"apiKey","description":"Please enter JWT with Bearer into field"}},"security":[{"Bearer":[]}]} \ No newline at end of file