public RepositoryResponse <string> Decrypt([FromBody] JObject model) { string data = model.GetValue("data")?.Value <string>(); var key = MixService.GetConfig <string>(MixAppSettingKeywords.ApiEncryptKey); return(new RepositoryResponse <string>() { Data = AesEncryptionHelper.DecryptString(data, key) }); }
public RepositoryResponse <string> Decrypt([FromBody] JObject model) { string data = model.GetValue("data")?.Value <string>(); //string key = model.GetValue("key")?.Value<string>(); var key = System.Text.Encoding.UTF8.GetBytes("sw-cms-secret-key"); return(new RepositoryResponse <string>() { Data = AesEncryptionHelper.DecryptString(data, Convert.ToBase64String(key)) }); }
public async Task <ActionResult <JObject> > ExternalLogin([FromBody] JObject data) { string message = data.Value <string>("message"); string key = MixService.GetConfig <string>(MixAppSettingKeywords.ApiEncryptKey); string decryptMsg = AesEncryptionHelper.DecryptString(message, key); var model = JsonConvert.DeserializeObject <RegisterExternalBindingModel>(decryptMsg); RepositoryResponse <JObject> loginResult = await _idService.ExternalLogin(model); if (loginResult.IsSucceed) { return(Ok(loginResult.Data)); } return(BadRequest(loginResult.Errors)); }
public async Task <ActionResult> Login([FromBody] JObject data) { string message = data.Value <string>("message"); string key = MixService.GetAppSetting <string>(MixAppSettingKeywords.ApiEncryptKey); string decryptMsg = AesEncryptionHelper.DecryptString(message, key); if (!string.IsNullOrEmpty(decryptMsg)) { var model = JsonConvert.DeserializeObject <LoginViewModel>(decryptMsg); RepositoryResponse <JObject> loginResult = new RepositoryResponse <JObject>(); loginResult = await _idService.Login(model); if (loginResult.IsSucceed) { return(Ok(loginResult.Data)); } return(BadRequest(loginResult.Errors)); } return(BadRequest()); }
public JObject Decrypt([FromBody] EncryptDataDto requestDto) { var key = requestDto.Key ?? MixService.GetAppSetting <string>(MixAppSettingKeywords.ApiEncryptKey); return(JObject.Parse(AesEncryptionHelper.DecryptString(requestDto.StringData, key))); }