// Copyright (c) .NET Foundation. All rights reserved. // Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information. using System; using System.Threading.Tasks; namespace Microsoft.AspNetCore.Authentication.Twitter { /// /// Default implementation. /// public class TwitterEvents : RemoteAuthenticationEvents { /// /// Gets or sets the function that is invoked when the Authenticated method is invoked. /// public Func OnCreatingTicket { get; set; } = context => Task.CompletedTask; /// /// Gets or sets the delegate that is invoked when the ApplyRedirect method is invoked. /// public Func, Task> OnRedirectToAuthorizationEndpoint { get; set; } = context => { context.Response.Redirect(context.RedirectUri); return Task.CompletedTask; }; /// /// Invoked whenever Twitter successfully authenticates a user /// /// Contains information about the login session as well as the user . /// A representing the completed operation. public virtual Task CreatingTicket(TwitterCreatingTicketContext context) => OnCreatingTicket(context); /// /// Called when a Challenge causes a redirect to authorize endpoint in the Twitter handler /// /// Contains redirect URI and of the challenge public virtual Task RedirectToAuthorizationEndpoint(RedirectContext context) => OnRedirectToAuthorizationEndpoint(context); } }