blob: 6c0d4224173c06baa3ed53270ba6cbb4a466d1ab (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Security.Authentication;
using System.Web.Http;
using Tango.TCC.BL.Web;
using Tango.TCC.Service.Filters;
using Tango.TCC.Service.Messages;
using Tango.TCC.Service.Models;
using Tango.TCC.Service.Security;
using Tango.Web.ActiveDirectory;
using Tango.Web.Controllers;
using Tango.Web.Security;
namespace Tango.TCC.Service.Controllers
{
public class AccountController : TangoController<TokenObject>
{
private ActiveDirectoryManager _ad_manager;
[HttpPost]
public LoginResponse Login(LoginRequest request)
{
LoginResponse response = new LoginResponse();
//var authResult = _ad_manager.ValidateUserCredentials(request.Email, request.Password);
//String fullName = authResult.UserInfo.GivenName + " " + authResult.UserInfo.FamilyName;
//if (!_ad_manager.CanUserAccessCurrentEnvironment(request.Email))
//{
// throw new AuthenticationException($"You do not have permissions to access the {TCCServiceConfig.DEPLOYMENT_SLOT.ToDescription()} environment.");
//}
response.AccessToken = WebToken<LoginUserResponse>.CreateNew(TCCServiceConfig.JWT_TOKEN_SECRET, new LoginUserResponse()
{
UserData = new User(request.Email, "Victoria", "Plitt", 22),
ExpirationDate = new DateTime(DateTime.MaxValue.Ticks)
}).AccessToken;
return response;
}
[JwtTokenFilter]
[HttpPost]
public void Logout(LoginRequest request)
{
// by email?
}
}
}
|