Files
OwinOAuthProviders/base/Owin.Security.Providers.OpenIDBase/Provider/OpenIDAuthenticationProvider.cs
2016-04-22 22:44:47 -04:00

51 lines
2.2 KiB
C#

using System;
using System.Threading.Tasks;
namespace Owin.Security.Providers.OpenIDBase
{
/// <summary>
/// Default <see cref="IOpenIDAuthenticationProvider"/> implementation.
/// </summary>
public class OpenIDAuthenticationProvider : IOpenIDAuthenticationProvider
{
/// <summary>
/// Initializes a <see cref="OpenIDAuthenticationProvider"/>
/// </summary>
public OpenIDAuthenticationProvider()
{
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<OpenIDAuthenticatedContext, Task> OnAuthenticated { get; set; }
/// <summary>
/// Gets or sets the function that is invoked when the ReturnEndpoint method is invoked.
/// </summary>
public Func<OpenIDReturnEndpointContext, Task> OnReturnEndpoint { get; set; }
/// <summary>
/// Invoked whenever OpenID successfully 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(OpenIDAuthenticatedContext 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">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 ReturnEndpoint(OpenIDReturnEndpointContext context)
{
return OnReturnEndpoint(context);
}
}
}