/*
* Licensed under the Apache License, Version 2.0 (http://www.apache.org/licenses/LICENSE-2.0)
* See https://github.com/openiddict/openiddict-core for more information concerning
* the license and the contributors participating to this project.
*/
using System;
using System.ComponentModel;
using JetBrains.Annotations;
using OpenIddict.Validation.AspNetCore;
namespace Microsoft.Extensions.DependencyInjection
{
///
/// Exposes the necessary methods required to configure
/// the OpenIddict validation ASP.NET Core integration.
///
public class OpenIddictValidationAspNetCoreBuilder
{
///
/// Initializes a new instance of .
///
/// The services collection.
public OpenIddictValidationAspNetCoreBuilder([NotNull] IServiceCollection services)
=> Services = services ?? throw new ArgumentNullException(nameof(services));
///
/// Gets the services collection.
///
[EditorBrowsable(EditorBrowsableState.Never)]
public IServiceCollection Services { get; }
///
/// Amends the default OpenIddict validation ASP.NET Core configuration.
///
/// The delegate used to configure the OpenIddict options.
/// This extension can be safely called multiple times.
/// The .
public OpenIddictValidationAspNetCoreBuilder Configure([NotNull] Action configuration)
{
if (configuration == null)
{
throw new ArgumentNullException(nameof(configuration));
}
Services.Configure(configuration);
return this;
}
///
/// Determines whether the specified object is equal to the current object.
///
/// The object to compare with the current object.
/// true if the specified object is equal to the current object; otherwise, false.
[EditorBrowsable(EditorBrowsableState.Never)]
public override bool Equals([CanBeNull] object obj) => base.Equals(obj);
///
/// Serves as the default hash function.
///
/// A hash code for the current object.
[EditorBrowsable(EditorBrowsableState.Never)]
public override int GetHashCode() => base.GetHashCode();
///
/// Returns a string that represents the current object.
///
/// A string that represents the current object.
[EditorBrowsable(EditorBrowsableState.Never)]
public override string ToString() => base.ToString();
}
}