public static void SaveValues() { using (IniFile iniFile = new IniFile(authfile)) { iniFile.IniWriteValue("tokens", "auth", Token); iniFile.IniWriteValue("expiry", "in", ExpiresIn); iniFile.IniWriteValue("expiry", "at", ExpiresAt.ToString()); iniFile.IniWriteValue("tokens", "refresh", RefreshToken); } }
public override string ToString() { return(string.Format("{0} {1} {2}", ID, ExpiresAt.ToString("hh:mm:ss.fff"), Expired)); }
public string Serialize() { using var ms = new MemoryStream(); using var writer = XmlDictionaryWriter.CreateTextWriter(ms, Encoding.UTF8, false); // <t:RequestSecurityTokenResponseCollection> writer.WriteStartElement(WsTrustConstants_1_3.PreferredPrefix, WsFederationConstants.Elements.RequestSecurityTokenResponseCollection, WsTrustConstants.Namespaces.WsTrust1_3); // <t:RequestSecurityTokenResponse> writer.WriteStartElement(WsTrustConstants_1_3.PreferredPrefix, WsTrustConstants.Elements.RequestSecurityTokenResponse, WsTrustConstants.Namespaces.WsTrust1_3); // @Context writer.WriteAttributeString(WsFederationConstants.Attributes.Context, Context); // <t:Lifetime> writer.WriteStartElement(WsTrustConstants.Elements.Lifetime, WsTrustConstants.Namespaces.WsTrust1_3); // <wsu:Created></wsu:Created> writer.WriteElementString(WsUtility.PreferredPrefix, WsUtility.Elements.Created, WsUtility.Namespace, CreatedAt.ToString(SamlConstants.GeneratedDateTimeFormat, DateTimeFormatInfo.InvariantInfo)); // <wsu:Expires></wsu:Expires> writer.WriteElementString(WsUtility.PreferredPrefix, WsUtility.Elements.Expires, WsUtility.Namespace, ExpiresAt.ToString(SamlConstants.GeneratedDateTimeFormat, DateTimeFormatInfo.InvariantInfo)); // </t:Lifetime> writer.WriteEndElement(); // <wsp:AppliesTo> writer.WriteStartElement(WsPolicy.PreferredPrefix, WsPolicy.Elements.AppliesTo, WsPolicy.Namespace); // <wsa:EndpointReference> writer.WriteStartElement(WsAddressing.PreferredPrefix, WsAddressing.Elements.EndpointReference, WsAddressing.Namespace); // <wsa:Address></wsa:Address> writer.WriteElementString(WsAddressing.PreferredPrefix, WsAddressing.Elements.Address, WsAddressing.Namespace, AppliesTo); writer.WriteEndElement(); // </wsa:EndpointReference> writer.WriteEndElement(); // </wsp:AppliesTo> // <t:RequestedSecurityToken> writer.WriteStartElement(WsTrustConstants_1_3.PreferredPrefix, WsTrustConstants.Elements.RequestedSecurityToken, WsTrustConstants.Namespaces.WsTrust1_3); // write assertion SecurityTokenHandler.WriteToken(writer, RequestedSecurityToken); // </t:RequestedSecurityToken> writer.WriteEndElement(); // </t:RequestSecurityTokenResponse> writer.WriteEndElement(); // <t:RequestSecurityTokenResponseCollection> writer.WriteEndElement(); writer.Flush(); return(Encoding.UTF8.GetString(ms.ToArray())); }