Last ...
This commit is contained in:
@@ -10,7 +10,6 @@ using xHttpService.Constants;
|
||||
using xIdentityModels.Dtos;
|
||||
using xIdentityService.Constants;
|
||||
using xModels.Dtos;
|
||||
using xModels.Extensions;
|
||||
|
||||
namespace xIdentityService.Providers
|
||||
{
|
||||
@@ -33,7 +32,7 @@ namespace xIdentityService.Providers
|
||||
Device = device,
|
||||
Payload = userSelectByParam,
|
||||
Action = XOpenActions.GetUserInfo,
|
||||
Timestamp = DateTime.UtcNow.AddMinutes(5)
|
||||
Timestamp = DateTime.UtcNow.AddMinutes(5).ToTimestamp()
|
||||
};
|
||||
if (!opaModel.Validate())
|
||||
{
|
||||
@@ -84,13 +83,13 @@ namespace xIdentityService.Providers
|
||||
// Prepare Rest Request ...
|
||||
var requestU = GetRestRequet(
|
||||
XApiAccountEndpoint.GetUserInfo,
|
||||
@params: new Dictionary<string, string>
|
||||
{
|
||||
{ XParam.XRequest.GetStringValue(), request }
|
||||
},
|
||||
headers: new Dictionary<string, string>
|
||||
{
|
||||
{ XAuthentication.TOKEN, token}
|
||||
},
|
||||
queryStrings: new Dictionary<string, string>
|
||||
{
|
||||
{ XParam.XRequest.GetStringValue(), request }
|
||||
}
|
||||
);
|
||||
|
||||
@@ -125,10 +124,10 @@ namespace xIdentityService.Providers
|
||||
// Retrieve Model and Validate it ...
|
||||
var responseModel = responseJson.FromJSON<XOpenActionRequestDto>();
|
||||
if (responseModel.IsNull() ||
|
||||
responseModel.Timestamp.IsExPired() ||
|
||||
responseModel.Payload.IsNullOrEmpty() ||
|
||||
// !responseModel.Device.IsSameAs(device) ||
|
||||
responseToken != responseModel.Checksum)
|
||||
responseToken != responseModel.Checksum ||
|
||||
responseModel.Timestamp.FromTimestamp().IsExPired())
|
||||
{
|
||||
XException.ActionFailed.Throw();
|
||||
}
|
||||
|
||||
@@ -154,14 +154,12 @@ namespace xIdentityService.Providers {
|
||||
/// <summary>
|
||||
/// Get an Instance of RestRequest
|
||||
/// </summary>
|
||||
/// <param name="endpoint"></param>
|
||||
/// <param name="params"></param>
|
||||
/// <returns></returns>
|
||||
public RestRequest GetRestRequet (
|
||||
XApiAccountEndpoint endpoint,
|
||||
IDictionary<string, string> @params = null,
|
||||
bool addXPoweredValue = true,
|
||||
IDictionary<string, string> headers = null
|
||||
IDictionary<string, string> @params = null,
|
||||
IDictionary<string, string> headers = null,
|
||||
IDictionary<string, string> queryStrings = null
|
||||
) {
|
||||
//
|
||||
var url = endpoint.GetStringValue ();
|
||||
@@ -180,6 +178,27 @@ namespace xIdentityService.Providers {
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Add Query Strings ...
|
||||
if (!queryStrings.IsNull () && queryStrings.Count > 0) {
|
||||
//
|
||||
url = $"{url}?";
|
||||
var enumerator = queryStrings.GetEnumerator ();
|
||||
while (enumerator.MoveNext ()) {
|
||||
//
|
||||
var item = enumerator.Current;
|
||||
|
||||
//
|
||||
url += $"{item.Key}={item.Value.ToUrlEncoded ()}&";
|
||||
}
|
||||
|
||||
//
|
||||
// remove lates & ...
|
||||
if (url.EndsWith ("&")) {
|
||||
url = url.Substring (0, url.Length - 1);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Create request ...
|
||||
var request = new RestRequest (url, DataFormat.Json);
|
||||
|
||||
Reference in New Issue
Block a user