/// <summary> /// Creates a new context object. /// </summary> /// <param name="context">The HTTP request context.</param> /// <param name="options">The <see cref="OAuthOptions"/>.</param> /// <param name="properties">The authentication properties of the challenge.</param> /// <param name="redirectUri">The initial redirect URI.</param> public OAuthRedirectToAuthorizationContext(HttpContext context, OAuthOptions options, AuthenticationProperties properties, string redirectUri) : base(context) { RedirectUri = redirectUri; Properties = properties; Options = options; }
private void ConfigureDefaults(OAuthOptions o) { o.ClientId = "Test Id"; o.ClientSecret = "secret"; o.SignInScheme = CookieAuthenticationDefaults.AuthenticationScheme; o.AuthorizationEndpoint = "https://example.com/provider/login"; o.TokenEndpoint = "https://example.com/provider/token"; o.CallbackPath = "/oauth-callback"; }
/// <summary> /// Initializes a new <see cref="OAuthCreatingTicketContext"/>. /// </summary> /// <param name="ticket">The <see cref="AuthenticationTicket"/>.</param> /// <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( AuthenticationTicket ticket, HttpContext context, OAuthOptions options, HttpClient backchannel, OAuthTokenResponse tokens) : this(ticket, context, options, backchannel, tokens, user : new JObject()) { }
/// <summary> /// Initializes a new <see cref="OAuthCreatingTicketContext"/>. /// </summary> /// <param name="ticket">The <see cref="AuthenticationTicket"/>.</param> /// <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( AuthenticationTicket ticket, 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; Ticket = ticket; }