Skip to content

Commit 32ac48a

Browse files
committed
Null agrument check added
1 parent 13ac2ca commit 32ac48a

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

src/AspNetCore.Authentication.Basic/BasicUtils.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,17 @@
11
// Copyright (c) Mihir Dilip. All rights reserved.
22
// Licensed under the MIT License. See License.txt in the project root for license information.
33

4+
using System;
45
using System.Collections.Generic;
56
using System.Linq;
67
using System.Security.Claims;
78

89
namespace AspNetCore.Authentication.Basic
910
{
10-
/// <summary>
11-
/// Utility class.
12-
/// </summary>
13-
internal static class BasicUtils
11+
/// <summary>
12+
/// Utility class.
13+
/// </summary>
14+
internal static class BasicUtils
1415
{
1516
/// <summary>
1617
/// Builds Claims Principal from the provided information.
@@ -24,8 +25,9 @@ internal static class BasicUtils
2425
/// <returns></returns>
2526
internal static ClaimsPrincipal BuildClaimsPrincipal(string username, string schemeName, string claimsIssuer, IEnumerable<Claim> claims = null)
2627
{
27-
var claimsList = new List<Claim>();
28+
if (string.IsNullOrWhiteSpace(schemeName)) throw new ArgumentNullException(nameof(schemeName));
2829

30+
var claimsList = new List<Claim>();
2931
if (claims != null) claimsList.AddRange(claims);
3032

3133
if (!claimsList.Any(c => c.Type == ClaimTypes.NameIdentifier))

0 commit comments

Comments
 (0)