// 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;
using Microsoft.AspNet.Authentication.Notifications;
using Microsoft.IdentityModel.Protocols;
namespace Microsoft.AspNet.Authentication.OpenIdConnect
{
///
/// Specifies events which the invokes to enable developer control over the authentication process.
///
public class OpenIdConnectAuthenticationNotifications
{
///
/// Creates a new set of notifications. Each notification has a default no-op behavior unless otherwise documented.
///
public OpenIdConnectAuthenticationNotifications()
{
AuthenticationFailed = notification => Task.FromResult(0);
AuthorizationCodeReceived = notification => Task.FromResult(0);
MessageReceived = notification => Task.FromResult(0);
SecurityTokenReceived = notification => Task.FromResult(0);
SecurityTokenValidated = notification => Task.FromResult(0);
RedirectToIdentityProvider = notification => Task.FromResult(0);
}
///
/// Invoked if exceptions are thrown during request processing. The exceptions will be re-thrown after this event unless suppressed.
///
public Func, Task> AuthenticationFailed { get; set; }
///
/// Invoked after security token validation if an authorization code is present in the protocol message.
///
public Func AuthorizationCodeReceived { get; set; }
///
/// Invoked when a protocol message is first received.
///
public Func, Task> MessageReceived { get; set; }
///
/// Invoked to manipulate redirects to the identity provider for SignIn, SignOut, or Challenge.
///
public Func, Task> RedirectToIdentityProvider { get; set; }
///
/// Invoked with the security token that has been extracted from the protocol message.
///
public Func, Task> SecurityTokenReceived { get; set; }
///
/// Invoked after the security token has passed validation and a ClaimsIdentity has been generated.
///
public Func, Task> SecurityTokenValidated { get; set; }
}
}