diff --git a/Dtos/XOpenActionDto.cs b/Dtos/XOpenActionDto.cs index 41f3b66..918a0d3 100644 --- a/Dtos/XOpenActionDto.cs +++ b/Dtos/XOpenActionDto.cs @@ -5,96 +5,104 @@ using xModels.Dtos; namespace xIdentityModels.Dtos { - public class XOpenActionDto + /// + /// a List of Available Open Actions ... + /// + public struct XOpenActions { - /// - /// a List of Available Open Actions ... - /// - public struct XOpenActions - { - public const string HandShake = "HandShake"; - public const string GetUserInfo = "GetUserInfo"; - } + public const string HandShake = "HandShake"; + public const string GetUserInfo = "GetUserInfo"; + } + + /// + /// Open Actions Request Model ... + /// + public class XOpenActionRequestDto : XBaseDto + { + // + public string Action { get; set; } + public string Payload { get; set; } + public string Checksum { get; set; } + public XDeviceDto Device { get; set; } + public DateTime Timestamp { get; set; } /// - /// Open Actions Request Model ... + /// Validate Model ... /// - public class XOpenActionRequestDto : XBaseDto + /// + public bool Validate() { // - public string Action { get; set; } - public string Payload { get; set; } - public string Checksum { get; set; } - public XDeviceDto Device { get; set; } - public DateTime Timestamp { get; set; } + var result = + !Device.IsNull() && + !Timestamp.IsNull() && + !Timestamp.IsExPired() && + !Action.IsNullOrEmpty() && + (Action == XOpenActions.HandShake || + Action == XOpenActions.GetUserInfo); - /// - /// Validate Model ... - /// - /// - public bool Validate() - { - // - var result = - !Device.IsNull() && - !Timestamp.IsNull() && - !Timestamp.IsExPired() && - !Action.IsNullOrEmpty() && - (Action == XOpenActions.HandShake || - Action == XOpenActions.GetUserInfo); - - // - return result; - } - - /// - /// Checksum Digest Model ... - /// - /// - public string ToOpenActionToken() - { - // - var result = string.Empty; - if (!Validate()) - { - return result; - } - - // - var tmp = this; - tmp.Checksum = string.Empty; - - // - result = $"{tmp.ToJSON()}" - .ToMd5String(); - return result; - } - - /// - /// Validate a Token is Correspond to Model or not ... - /// - /// - /// - public bool ValidateToken(string token) - { - // - var result = - Validate() && - !token.IsNullOrEmpty() && - token == ToOpenActionToken(); - - // - return result; - } + // + return result; } /// - /// aa Dto which used between Api's ... + /// Checksum Digest Model ... /// - public class XOpenActionInnerDto : XBaseDto + /// + public string ToOpenActionToken() { - public string Token { get; set; } - public string Payload { get; set; } + // + var result = string.Empty; + if (!Validate()) + { + return result; + } + + // + var tmp = this; + tmp.Checksum = string.Empty; + + // + result = $"{tmp.ToJSON()}" + .ToMd5String(); + return result; + } + + /// + /// Validate a Token is Correspond to Model or not ... + /// + /// + /// + public bool ValidateToken(string token) + { + // + var result = + Validate() && + !token.IsNullOrEmpty() && + token == ToOpenActionToken(); + + // + return result; } } + + /// + /// aa Dto which used between Api's ... + /// + public class XOpenActionInnerDto : XBaseDto + { + public string Token { get; set; } + public string Payload { get; set; } + } + + /// + /// User Info Providing in Open Actions ... + /// + public class XOpenActionUserInfoDto : XBaseDto + { + public string Username { get; set; } + public string Firstname { get; set; } + public string Lastname { get; set; } + public string Avatar { get; set; } + } } \ No newline at end of file