private IAuthorizationContext CreateContext(NameValueCollection querystring)
        {
            AuthorizationContext context = new AuthorizationContext();

            context.Client       = CreateClient(querystring[Parameters.ClientId], querystring[Parameters.ClientSecret]);
            context.RedirectUri  = ContextBuilderHelpers.CreateRedirectUri(querystring[Parameters.RedirectUri]);
            context.ResponseType = querystring[Parameters.ResponseType];
            context.State        = querystring[Parameters.State];
            context.Scope        = ContextBuilderHelpers.CreateScope(querystring[Parameters.Scope]);

            context.QueryString = querystring;
            return(context);
        }
 private ITokenContext CreateContext(NameValueCollection querystring, NameValueCollection form, NameValueCollection headers)
 {
     return(new TokenContext()
     {
         Client = new ClientBase
         {
             ClientId = form[Parameters.ClientId],
             ClientSecret = form[Parameters.ClientSecret]
         },
         AuthorizationCode = form[Parameters.AuthroizationCode],
         GrantType = form[Parameters.GrantType],
         RedirectUri = ContextBuilderHelpers.CreateRedirectUri(form[Parameters.RedirectUri]),
         ResourceOwnerUsername = form[Parameters.ResourceOwnerUsername],
         ResourceOwnerPassword = form[Parameters.ResourceOwnerPassword],
         RefreshToken = form[Parameters.RefreshToken],
         Scope = ContextBuilderHelpers.CreateScope(form[Parameters.Scope]),
         Headers = headers,
         Form = form,
         QueryString = querystring
     });
 }