// 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.AspNet.Authentication.OpenIdConnect
{
///
/// Specifies events which the invokes to enable developer control over the authentication process.
///
public interface IOpenIdConnectAuthenticationEvents
{
///
/// Invoked if exceptions are thrown during request processing. The exceptions will be re-thrown after this event unless suppressed.
///
Task AuthenticationFailed(AuthenticationFailedContext context);
///
/// Invoked after security token validation if an authorization code is present in the protocol message.
///
Task AuthorizationCodeReceived(AuthorizationCodeReceivedContext context);
///
/// Invoked after "authorization code" is redeemed for tokens at the token endpoint.
///
Task AuthorizationCodeRedeemed(AuthorizationCodeRedeemedContext context);
///
/// Invoked when a protocol message is first received.
///
Task MessageReceived(MessageReceivedContext context);
///
/// Invoked to manipulate redirects to the identity provider for SignIn, SignOut, or Challenge.
///
Task RedirectToIdentityProvider(RedirectToIdentityProviderContext context);
///
/// Invoked with the security token that has been extracted from the protocol message.
///
Task SecurityTokenReceived(SecurityTokenReceivedContext context);
///
/// Invoked after the security token has passed validation and a ClaimsIdentity has been generated.
///
Task SecurityTokenValidated(SecurityTokenValidatedContext context);
}
}