// 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.Threading.Tasks;
namespace Microsoft.AspNetCore.Authentication.Cookies
{
///
/// Specifies callback methods which the invokes to enable developer control over the authentication process. />
///
public interface ICookieAuthenticationEvents
{
///
/// Called each time a request principal has been validated by the middleware. By implementing this method the
/// application may alter or reject the principal which has arrived with the request.
///
/// Contains information about the login session as well as the user .
/// A representing the completed operation.
Task ValidatePrincipal(CookieValidatePrincipalContext context);
///
/// Called when an endpoint has provided sign in information before it is converted into a cookie. By
/// implementing this method the claims and extra information that go into the ticket may be altered.
///
/// Contains information about the login session as well as the user .
Task SigningIn(CookieSigningInContext context);
///
/// Called when an endpoint has provided sign in information after it is converted into a cookie.
///
/// Contains information about the login session as well as the user .
Task SignedIn(CookieSignedInContext context);
///
/// Called when a SignOut causes a redirect in the cookie middleware.
///
/// Contains information about the event
Task RedirectToLogout(CookieRedirectContext context);
///
/// Called when a SignIn causes a redirect in the cookie middleware.
///
/// Contains information about the event
Task RedirectToLogin(CookieRedirectContext context);
///
/// Called when redirecting back to the return url in the cookie middleware.
///
/// Contains information about the event
Task RedirectToReturnUrl(CookieRedirectContext context);
///
/// Called when an access denied causes a redirect in the cookie middleware.
///
/// Contains information about the event
Task RedirectToAccessDenied(CookieRedirectContext context);
///
/// Called during the sign-out flow to augment the cookie cleanup process.
///
/// Contains information about the login session as well as information about the authentication cookie.
Task SigningOut(CookieSigningOutContext context);
}
}