// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
using Microsoft.AspNetCore.Authentication;
namespace ZeroFramework.IdentityServer.API.Infrastructure.Authentication.Microsoft;
///
/// Extension methods to configure Microsoft Account OAuth authentication.
///
public static class MicrosoftAccountExtensions
{
///
/// Adds Microsoft Account OAuth-based authentication to using the default scheme.
/// The default scheme is specified by .
///
/// Microsoft Account authentication allows application users to sign in with their work, school, or personal Microsoft account.
///
///
/// The .
/// A reference to after the operation has completed.
public static AuthenticationBuilder AddMicrosoftAccount(this AuthenticationBuilder builder)
=> builder.AddMicrosoftAccount(MicrosoftAccountDefaults.AuthenticationScheme, _ => { });
///
/// Adds Microsoft Account OAuth-based authentication to using the default scheme.
/// The default scheme is specified by .
///
/// Microsoft Account authentication allows application users to sign in with their work, school, or personal Microsoft account.
///
///
/// The .
/// A delegate to configure .
/// A reference to after the operation has completed.
public static AuthenticationBuilder AddMicrosoftAccount(this AuthenticationBuilder builder, Action configureOptions)
=> builder.AddMicrosoftAccount(MicrosoftAccountDefaults.AuthenticationScheme, configureOptions);
///
/// Adds Microsoft Account OAuth-based authentication to using the default scheme.
/// The default scheme is specified by .
///
/// Microsoft Account authentication allows application users to sign in with their work, school, or personal Microsoft account.
///
///
/// The .
/// The authentication scheme.
/// A delegate to configure .
/// A reference to after the operation has completed.
public static AuthenticationBuilder AddMicrosoftAccount(this AuthenticationBuilder builder, string authenticationScheme, Action configureOptions)
=> builder.AddMicrosoftAccount(authenticationScheme, MicrosoftAccountDefaults.DisplayName, configureOptions);
///
/// Adds Microsoft Account OAuth-based authentication to using the default scheme.
/// The default scheme is specified by .
///
/// Microsoft Account authentication allows application users to sign in with their work, school, or personal Microsoft account.
///
///
/// The .
/// The authentication scheme.
/// A display name for the authentication handler.
/// A delegate to configure .
/// A reference to after the operation has completed.
public static AuthenticationBuilder AddMicrosoftAccount(this AuthenticationBuilder builder, string authenticationScheme, string displayName, Action configureOptions)
=> builder.AddOAuth(authenticationScheme, displayName, configureOptions);
}