/// <summary> /// Serialize <see cref="OpenApiOAuthFlow"/> to Open Api v3.0 /// </summary> public void SerializeAsV3(IOpenApiWriter writer) { if (writer == null) { throw Error.ArgumentNull(nameof(writer)); } writer.WriteStartObject(); // authorizationUrl writer.WriteProperty(OpenApiConstants.AuthorizationUrl, AuthorizationUrl?.ToString()); // tokenUrl writer.WriteProperty(OpenApiConstants.TokenUrl, TokenUrl?.ToString()); // refreshUrl writer.WriteProperty(OpenApiConstants.RefreshUrl, RefreshUrl?.ToString()); // scopes writer.WriteRequiredMap(OpenApiConstants.Scopes, Scopes, (w, s) => w.WriteValue(s)); // extensions writer.WriteExtensions(Extensions); writer.WriteEndObject(); }
public Site(Uri url, string content, Host host) { Url = url; Content = content; LastVisited = DateTime.Now; host.LastVisited = DateTime.Now; Host = host; TokenUrl = new TokenUrl(url); }
/// <summary>Serves as the default hash function.</summary> /// <returns>A hash code for the current object.</returns> public override int GetHashCode() { unchecked { var hc = 17L; if (AuthorizationUrl != null) { hc = (hc * 23) + AuthorizationUrl.GetHashCode(); } if (TokenUrl != null) { hc = (hc * 23) + TokenUrl.GetHashCode(); } if (RefreshUrl != null) { hc = (hc * 23) + RefreshUrl.GetHashCode(); } hc = (hc * 23) + Scopes.Count; return(((int)(hc >> 32)) ^ (int)hc); } }
private string ParseTokenOutOfUrl() { return(TokenUrl.Substring(TokenUrl.IndexOf(TokenTag) + TokenTag.Length)); }
private bool CanSubmitTokenUrl(object obj) { return(TokenUrl != null?TokenUrl.Contains(TokenTag) : false); }