protected virtual FormUrlEncodedContent GetTokenPostContent(string code, Uri redirectUri, string codeVerifier, Dictionary <string, string> additionalProperties = null) { Dictionary <string, string> parameters = GenerateTokenEndpointRequestParameters(); parameters.Add("grant_type", "authorization_code"); parameters.Add("redirect_uri", redirectUri.AbsoluteUri); parameters.Add("code", code); parameters.Add("code_verifier", codeVerifier); return(OAuth2Client.CreateForm(parameters)); }
internal static string CreateAuthorizationUrl(string authority , string clientId , string scope , string redirectUri , string responseType , string responseMode , string maxAge , string codeVerifier , string state = null , string prompt = null) { string nonce = Guid.NewGuid().ToString("N"); var result = OAuth2Client.CreateUrl(GenerateAuthorizeEndpoint(authority), clientId, scope, redirectUri, responseType , responseMode, maxAge, codeVerifier, state, prompt, nonce); if (!string.IsNullOrEmpty(ApplicationSettings.IdTokenHint)) { result = string.Format("{0}&id_token_hint={1}", result, ApplicationSettings.IdTokenHint); } return(result); }
/// <summary> /// FormUrlEncodes both Sets of Key Value Pairs into one form object /// /// </summary> /// <param name="explicitProperties"/><param name="additionalProperties"/> /// <returns/> private static FormUrlEncodedContent CreateForm(Dictionary <string, string> explicitProperties, Dictionary <string, string> additionalProperties = null) { return(new FormUrlEncodedContent((IEnumerable <KeyValuePair <string, string> >)OAuth2Client.MergeAdditionKeyValuePairsIntoExplicitKeyValuePairs(explicitProperties, additionalProperties))); }