public string BuildAuthorizationUrl(QQConnectProperties qqConnectProperties, string state) { var scopes = _options.Scopes; var isMobile = _options.IsMobile; if (qqConnectProperties != null) { if (qqConnectProperties.Scopes != null) { scopes = qqConnectProperties.Scopes; } isMobile = qqConnectProperties.IsMobile; } var scope = string.Join(",", scopes); var authorizationUrl = AuthorizationEndpoint + "?response_type=code" + "&client_id=" + Uri.EscapeDataString(_options.ClientId) + "&redirect_uri=" + Uri.EscapeDataString(_options.RedirectUrl()) + "&state=" + Uri.EscapeDataString(state) + "&scope=" + Uri.EscapeDataString(scope); if (isMobile) { authorizationUrl += "&display=mobile"; } return(authorizationUrl); }
public static QQConnectProperties GetQQConnectProperties( this IDictionary <string, string> dictionary) { if (dictionary == null) { return(null); } if (dictionary.ContainsKey(QQConnectProperties.Key) == false) { return(null); } return(QQConnectProperties.From(dictionary[QQConnectProperties.Key])); }
public static void SetQQConnectProperties( this IDictionary <string, string> dictionary, QQConnectProperties qqConnectProperties) { if (dictionary == null) { throw new ArgumentNullException(nameof(dictionary)); } if (qqConnectProperties == null) { throw new ArgumentNullException(nameof(qqConnectProperties)); } dictionary[QQConnectProperties.Key] = qqConnectProperties.ToJson(); }