public override string GetAccessCodeUrl(AuthenticationResponseType responseType, string redirectUrl, List <string> state, Dictionary <string, string> extraData) { var k = DateTime.Now.ToString("yyyyMMddHHmmssff").ToBase64().Substring(0, 16); var nonce = DateTime.Now.ToString("yyyyMMddHHmmss") + k; extraData.Add("nonce", nonce); return(base.GetAccessCodeUrl(responseType, redirectUrl, state, extraData)); }
// 1 public virtual string GetAccessCodeUrl(AuthenticationResponseType responseType, string redirectUrl, List <string> state, Dictionary <string, string> extraData) { var dic = new Dictionary <string, string> { { "response_type", responseType == AuthenticationResponseType.Code ? "code" : "token" }, { ClientIdKeyword, _configuration.ClientId } }; if (!redirectUrl.IsEmpty()) { dic.Add("redirect_uri", HttpUtility.UrlEncode(redirectUrl)); } dic.Add(ScopeKeyword, _configuration.Scope.IsEmpty() ? DefaultScope : _configuration.Scope); if (extraData != null && extraData.Count > 0) { foreach (var key in extraData.Keys) { dic.Add(key, extraData[key]); } } if (state != null && state.Count > 0) { var st = ""; foreach (var s in state) { if (!string.IsNullOrWhiteSpace(s)) { st += "|"; } st += s; } dic.Add("state", st); } var url = AccessCodeServiceEndpoint; url += url.Contains("?") ? "&" : "?"; url += dic.ToEncode(); return(url.Replace("%2520", "%20")); }
public override string GetAccessCodeUrl(AuthenticationResponseType responseType, string redirectUrl, List <string> state, Dictionary <string, string> extraData) { state.Add(DateTime.Now.ToString("yyyyMMddHHmmss")); return(base.GetAccessCodeUrl(responseType, redirectUrl, state, extraData)); }