53 lines
2.2 KiB
C#
53 lines
2.2 KiB
C#
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
|
|
|
|
using System;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Owin.Security.Providers.Yahoo
|
|
{
|
|
/// <summary>
|
|
/// Default <see cref="IYahooAuthenticationProvider"/> implementation.
|
|
/// </summary>
|
|
public class YahooAuthenticationProvider : IYahooAuthenticationProvider
|
|
{
|
|
/// <summary>
|
|
/// Initializes a <see cref="YahooAuthenticationProvider"/>
|
|
/// </summary>
|
|
public YahooAuthenticationProvider()
|
|
{
|
|
OnAuthenticated = context => Task.FromResult<object>(null);
|
|
OnReturnEndpoint = context => Task.FromResult<object>(null);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets or sets the function that is invoked when the Authenticated method is invoked.
|
|
/// </summary>
|
|
public Func<YahooAuthenticatedContext, Task> OnAuthenticated { get; set; }
|
|
|
|
/// <summary>
|
|
/// Gets or sets the function that is invoked when the ReturnEndpoint method is invoked.
|
|
/// </summary>
|
|
public Func<YahooReturnEndpointContext, Task> OnReturnEndpoint { get; set; }
|
|
|
|
/// <summary>
|
|
/// Invoked whenever Yahoo succesfully authenticates a user
|
|
/// </summary>
|
|
/// <param name="context">Contains information about the login session as well as the user <see cref="System.Security.Claims.ClaimsIdentity"/>.</param>
|
|
/// <returns>A <see cref="Task"/> representing the completed operation.</returns>
|
|
public virtual Task Authenticated(YahooAuthenticatedContext context)
|
|
{
|
|
return OnAuthenticated(context);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Invoked prior to the <see cref="System.Security.Claims.ClaimsIdentity"/> being saved in a local cookie and the browser being redirected to the originally requested URL.
|
|
/// </summary>
|
|
/// <param name="context"></param>
|
|
/// <returns>A <see cref="Task"/> representing the completed operation.</returns>
|
|
public virtual Task ReturnEndpoint(YahooReturnEndpointContext context)
|
|
{
|
|
return OnReturnEndpoint(context);
|
|
}
|
|
}
|
|
}
|