/// <summary>
 /// Initializes a new <see cref="OAuthCreatingTicketContext"/>.
 /// </summary>
 /// <param name="context">The HTTP environment.</param>
 /// <param name="options">The options used by the authentication middleware.</param>
 /// <param name="backchannel">The HTTP client used by the authentication middleware</param>
 /// <param name="tokens">The tokens returned from the token endpoint.</param>
 public OAuthCreatingTicketContext(
     HttpContext context,
     OAuthOptions options,
     HttpClient backchannel,
     OAuthTokenResponse tokens)
     : this(context, options, backchannel, tokens, user: new JObject())
 {
 }
        /// <summary>
        /// Initializes a new <see cref="OAuthCreatingTicketContext"/>.
        /// </summary>
        /// <param name="context">The HTTP environment.</param>
        /// <param name="options">The options used by the authentication middleware.</param>
        /// <param name="backchannel">The HTTP client used by the authentication middleware</param>
        /// <param name="tokens">The tokens returned from the token endpoint.</param>
        /// <param name="user">The JSON-serialized user.</param>
        public OAuthCreatingTicketContext(
            HttpContext context,
            OAuthOptions options,
            HttpClient backchannel,
            OAuthTokenResponse tokens,
            JObject user)
            : base(context)
        {
            if (context == null)
            {
                throw new ArgumentNullException(nameof(context));
            }

            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            if (backchannel == null)
            {
                throw new ArgumentNullException(nameof(backchannel));
            }

            if (tokens == null)
            {
                throw new ArgumentNullException(nameof(tokens));
            }

            if (user == null)
            {
                throw new ArgumentNullException(nameof(user));
            }

            TokenResponse = tokens;
            Backchannel = backchannel;
            User = user;
            Options = options;
        }