diff options
Diffstat (limited to 'Software/Visual_Studio/Web/Tango.MachineService.Gateway/Controllers')
4 files changed, 0 insertions, 155 deletions
diff --git a/Software/Visual_Studio/Web/Tango.MachineService.Gateway/Controllers/AzureUtilsController.cs b/Software/Visual_Studio/Web/Tango.MachineService.Gateway/Controllers/AzureUtilsController.cs deleted file mode 100644 index ae5aa4543..000000000 --- a/Software/Visual_Studio/Web/Tango.MachineService.Gateway/Controllers/AzureUtilsController.cs +++ /dev/null @@ -1,59 +0,0 @@ -using Microsoft.IdentityModel.Clients.ActiveDirectory; -using System; -using System.Collections.Generic; -using System.Linq; -using System.Security.Authentication; -using System.Threading.Tasks; -using System.Web; -using System.Web.Mvc; -using Tango.AzureUtils; -using Tango.AzureUtils.Web; -using Tango.MachineService.Gateway.Filters; -using Tango.Web.Controllers; -using Tango.Web.Security; - -namespace Tango.MachineService.Gateway.Controllers -{ - public class AzureUtilsController : TangoController<AzureUtilsController.TokenObject> - { - public class TokenObject - { - public String Email { get; set; } - } - - [HttpPost] - public async Task<LoginResponse> Login(LoginRequest request) - { - var azure = await AzureUtils.AzureUtilsAuthenticationFactory.AuthenticateOrGetAsync(); - AzureUtils.ActiveDirectory.ActiveDirectoryManager adManager = new AzureUtils.ActiveDirectory.ActiveDirectoryManager(azure); - - try - { - await adManager.Authenticate(request.Email, request.Password); - } - catch (Exception ex) - { - throw new AuthenticationException("The specified email or password is incorrect.", ex); - } - - if (!adManager.IsUserMemberOf(GatewayConfig.AZURE_UTILS_GROUP, request.Email)) - { - throw new AuthenticationException("The specified user is not authorized to access the resource."); - } - - return new LoginResponse() - { - AccessToken = WebToken<TokenObject>.CreateNew(GatewayConfig.JWT_TOKEN_SECRET, new TokenObject() - { - Email = request.Email, - }, DateTime.UtcNow.AddDays(1)).AccessToken, - }; - } - - [JwtTokenFilter] - public AzureUtilsCredentials GetCredentials() - { - return AzureUtils.AzureUtilsAuthenticationFactory.GetGlobalCredentials(); - } - } -}
\ No newline at end of file diff --git a/Software/Visual_Studio/Web/Tango.MachineService.Gateway/Controllers/GatewayController.cs b/Software/Visual_Studio/Web/Tango.MachineService.Gateway/Controllers/GatewayController.cs deleted file mode 100644 index e393c7264..000000000 --- a/Software/Visual_Studio/Web/Tango.MachineService.Gateway/Controllers/GatewayController.cs +++ /dev/null @@ -1,41 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Web.Http; -using Tango.MachineService.Gateway.DB; -using Tango.MachineService.Gateway.DTO; -using Tango.MachineService.Gateway.Messages; -using Tango.Web.Controllers; - -namespace Tango.MachineService.Gateway.Controllers -{ - public class GatewayController : TangoController - { - [HttpPost] - public EnvironmentsResponse GetEnvironments(EnvironmentsRequest request) - { - EnvironmentsResponse response = new EnvironmentsResponse(); - - using (GatewayDbContext db = GatewayDbContext.CreateDefault()) - { - var envs = db.Environments.Where(x => x.Active).ToList(); - - foreach (var env in envs) - { - response.Environments.Add(new EnvironmentConfiguration() - { - ID = env.ID.ToString(), - Name = env.Name, - Description = env.Description, - MachineServiceAddress = env.MachineServiceAddress, - DisplayIndex = env.DisplayIndex - }); - } - } - - return response; - } - } -} diff --git a/Software/Visual_Studio/Web/Tango.MachineService.Gateway/Controllers/HomeController.cs b/Software/Visual_Studio/Web/Tango.MachineService.Gateway/Controllers/HomeController.cs deleted file mode 100644 index f510f360c..000000000 --- a/Software/Visual_Studio/Web/Tango.MachineService.Gateway/Controllers/HomeController.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; -using System.Web.Mvc; - -namespace Tango.MachineService.Gateway.Controllers -{ - public class HomeController : Controller - { - public String Index() - { - return "Twine Gateway Service"; - } - } -} diff --git a/Software/Visual_Studio/Web/Tango.MachineService.Gateway/Controllers/ValuesController.cs b/Software/Visual_Studio/Web/Tango.MachineService.Gateway/Controllers/ValuesController.cs deleted file mode 100644 index 2c742706e..000000000 --- a/Software/Visual_Studio/Web/Tango.MachineService.Gateway/Controllers/ValuesController.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Net; -using System.Net.Http; -using System.Web.Http; - -namespace Tango.MachineService.Gateway.Controllers -{ - public class ValuesController : ApiController - { - // GET api/values - public IEnumerable<string> Get() - { - return new string[] { "value1", "value2" }; - } - - // GET api/values/5 - public string Get(int id) - { - return "value"; - } - - // POST api/values - public void Post([FromBody]string value) - { - } - - // PUT api/values/5 - public void Put(int id, [FromBody]string value) - { - } - - // DELETE api/values/5 - public void Delete(int id) - { - } - } -} |
