-
Notifications
You must be signed in to change notification settings - Fork 255
Expand file tree
/
Copy pathDenyGuestsExtensions.cs
More file actions
29 lines (25 loc) · 1.01 KB
/
DenyGuestsExtensions.cs
File metadata and controls
29 lines (25 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
using Microsoft.AspNetCore.Authorization;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;
namespace Microsoft.Identity.Web
{
/// <summary>
/// Extensions for building the deny guest requirement during application startup.
/// </summary>
public static class DenyGuestsExtensions
{
/// <summary>
/// This method adds support for the deny guests requirement.
/// </summary>
/// <param name="services">The services being configured.</param>
/// <returns>Services.</returns>
public static IServiceCollection AddDenyGuestsAuthorization(this IServiceCollection services)
{
services.AddAuthorization();
services.TryAddEnumerable(ServiceDescriptor.Singleton<IAuthorizationHandler, DenyGuestsAuthorizationsHandler>());
return services;
}
}
}