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