public static string GetSott(SottDetails _SottDetails) { string secret = LoginRadiusAppSettings.AppSecret; string key = LoginRadiusAppSettings.AppKey; if (!string.IsNullOrWhiteSpace(secret) && !string.IsNullOrWhiteSpace(key)) { string tempToken = string.Empty; if (_SottDetails.Sott.StartTime != null && _SottDetails.Sott.EndTime != null) { tempToken = Convert.ToDateTime(_SottDetails.Sott.StartTime) .ToString("yyyy/M/d H:m:s", CultureInfo.InvariantCulture) + "#" + key + "#" + Convert.ToDateTime(_SottDetails.Sott.EndTime) .ToString("yyyy/M/d H:m:s", CultureInfo.InvariantCulture); } else { tempToken = DateTime.UtcNow.ToString("yyyy/M/d H:m:s", CultureInfo.InvariantCulture) + "#" + key + "#" + DateTime.UtcNow.AddMinutes(10).ToString("yyyy/M/d H:m:s", CultureInfo.InvariantCulture); } var token = Encrypt(tempToken, secret); var hash = CreateMd5(token); //return token.Replace("+", "%2B") + "*" + hash; return(token + "*" + hash); } return(string.Empty); }
public JsonResult Register(UserIdentityCreateModel identityCreateModel) { identityCreateModel.PhoneId = "+919667286111"; identityCreateModel.IsTwoFactorAuthenticationEnabled = true; identityCreateModel.Password = "******"; identityCreateModel.UserName = "******"; foreach (var item in identityCreateModel.Email) { var Type = item.Type; var Value = item.Value; } SottDetails _SottDetails = new SottDetails(); _SottDetails.Sott = new Sott(); //_SottDetails.Sott.StartTime = DateTime.UtcNow.ToString(); //_SottDetails.Sott.EndTime = DateTime.UtcNow.AddMinutes(10).ToString(); _SottDetails.Sott.StartTime = null; _SottDetails.Sott.EndTime = null; _SottDetails.Sott.TimeDifference = "10"; var apiResponse = new RegisterEntity().RegisterCustomer(identityCreateModel, _apiOptionalParams, _SottDetails); _apiOptionalParams.VerificationUrl = "VerificationUrl"; return(Json(apiResponse, JsonRequestBehavior.AllowGet)); }
public ApiResponse <LoginRadiusPostResponse> PhoneUserRegistrationbySMS(SottDetails _SottDetails, LoginRadiusApiOptionalParams _LoginRadiusApiOptionalParams, UserIdentityCreateModel _UserIdentityCreateModel) { var additionalparams = new QueryParameters(); if (string.IsNullOrEmpty(_LoginRadiusApiOptionalParams.VerificationUrl)) { additionalparams.Add("verificationUrl", _LoginRadiusApiOptionalParams.VerificationUrl); } if (string.IsNullOrEmpty(_LoginRadiusApiOptionalParams.SmsTemplate)) { additionalparams.Add("smsTemplate", _LoginRadiusApiOptionalParams.SmsTemplate); } var timediffrence = new QueryParameters { ["timedifference"] = _SottDetails.Sott.TimeDifference }; if (_SottDetails.Sott.StartTime == null) { ApiResponse <SottDetails> sottresponse = ConfigureAndExecute <SottDetails>(RequestType.ServerInfo, HttpMethod.Get, null, timediffrence); if (sottresponse.Response != null) { _SottDetails = sottresponse.Response; } } additionalparams.Add("sott", LoginRadiusSecureOneTimeToken.GetSott(_SottDetails)); return(ConfigureAndExecute <LoginRadiusPostResponse>(RequestType.Authentication, HttpMethod.Post, "register", additionalparams, _UserIdentityCreateModel.ConvertToJson())); }
public ApiResponse <LoginRadiusPostResponse> RegisterCustomer(UserIdentityCreateModel socialUserProfile, LoginRadiusApiOptionalParams optionalParams, SottDetails _SottDetails) { var additionalQueryParams = new QueryParameters(); additionalQueryParams.AddOptionalParamsRange(optionalParams); var timediffrence = new QueryParameters { ["timedifference"] = _SottDetails.Sott.TimeDifference }; if (_SottDetails.Sott.StartTime == null) { ApiResponse <SottDetails> sottresponse = ConfigureAndExecute <SottDetails>(RequestType.ServerInfo, HttpMethod.Get, null, timediffrence); if (sottresponse.Response != null) { _SottDetails = sottresponse.Response; } } additionalQueryParams.Add("sott", GetSott(_SottDetails)); return(ConfigureAndExecute <LoginRadiusPostResponse>(RequestType.Authentication, HttpMethod.Post, _resoucePath.ToString(), additionalQueryParams, socialUserProfile.ConvertToJson())); }