|
|
@ -17,6 +17,14 @@ using BCS.BMC.Authorization; |
|
|
|
using BCS.BMC.Authorization.Users; |
|
|
|
using BCS.BMC.Models.TokenAuth; |
|
|
|
using BCS.BMC.MultiTenancy; |
|
|
|
//using System.Web.Mvc;
|
|
|
|
using BCS.BMC.CompanyMasters.Dto; |
|
|
|
using System.Net; |
|
|
|
using System.Net.Http; |
|
|
|
using Newtonsoft.Json; |
|
|
|
using System.Net.Http.Headers; |
|
|
|
using BCS.BMC.BMC.CompanyMasters; |
|
|
|
using Abp.Domain.Repositories; |
|
|
|
|
|
|
|
namespace BCS.BMC.Controllers |
|
|
|
{ |
|
|
@ -30,6 +38,7 @@ namespace BCS.BMC.Controllers |
|
|
|
private readonly IExternalAuthConfiguration _externalAuthConfiguration; |
|
|
|
private readonly IExternalAuthManager _externalAuthManager; |
|
|
|
private readonly UserRegistrationManager _userRegistrationManager; |
|
|
|
private readonly IRepository<CompanyMaster, int> _companyMaster; |
|
|
|
|
|
|
|
public TokenAuthController( |
|
|
|
LogInManager logInManager, |
|
|
@ -38,7 +47,8 @@ namespace BCS.BMC.Controllers |
|
|
|
TokenAuthConfiguration configuration, |
|
|
|
IExternalAuthConfiguration externalAuthConfiguration, |
|
|
|
IExternalAuthManager externalAuthManager, |
|
|
|
UserRegistrationManager userRegistrationManager) |
|
|
|
UserRegistrationManager userRegistrationManager, |
|
|
|
IRepository<CompanyMaster, int> companyMaster) |
|
|
|
{ |
|
|
|
_logInManager = logInManager; |
|
|
|
_tenantCache = tenantCache; |
|
|
@ -47,6 +57,7 @@ namespace BCS.BMC.Controllers |
|
|
|
_externalAuthConfiguration = externalAuthConfiguration; |
|
|
|
_externalAuthManager = externalAuthManager; |
|
|
|
_userRegistrationManager = userRegistrationManager; |
|
|
|
_companyMaster = companyMaster; |
|
|
|
} |
|
|
|
|
|
|
|
[HttpPost] |
|
|
@ -232,5 +243,20 @@ namespace BCS.BMC.Controllers |
|
|
|
{ |
|
|
|
return SimpleStringCipher.Instance.Encrypt(accessToken); |
|
|
|
} |
|
|
|
|
|
|
|
[HttpGet] |
|
|
|
public async Task<ActionResult> ValidateTenancy(GetUrlDto input) |
|
|
|
{ |
|
|
|
if (input.InputUrl == null) |
|
|
|
{ |
|
|
|
return BadRequest(); |
|
|
|
} |
|
|
|
var company = await _companyMaster.FirstOrDefaultAsync(x => x.Url == input.InputUrl.ToString()); |
|
|
|
if (company == null) |
|
|
|
{ |
|
|
|
return BadRequest(); |
|
|
|
} |
|
|
|
return Ok(); |
|
|
|
} |
|
|
|
} |
|
|
|
} |