// 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.AspNet.Authentication.Twitter
{
///
/// Default implementation.
///
public class TwitterEvents : RemoteAuthenticationEvents, ITwitterEvents
{
///
/// Gets or sets the function that is invoked when the Authenticated method is invoked.
///
public Func OnCreatingTicket { get; set; } = context => Task.FromResult(0);
///
/// Gets or sets the delegate that is invoked when the ApplyRedirect method is invoked.
///
public Func OnRedirectToAuthorizationEndpoint { get; set; } = context =>
{
context.Response.Redirect(context.RedirectUri);
return Task.FromResult(0);
};
///
/// 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 middleware
///
/// Contains redirect URI and of the challenge
public virtual Task RedirectToAuthorizationEndpoint(TwitterRedirectToAuthorizationEndpointContext context) => OnRedirectToAuthorizationEndpoint(context);
}
}