Skip to content

Commit 175121b

Browse files
removed a now redundant method
1 parent 24535fb commit 175121b

File tree

1 file changed

+0
-20
lines changed

1 file changed

+0
-20
lines changed

5-WebApp-AuthZ/5-2-Groups/Services/MicrosoftGraph-Rest/GraphHelper.cs

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -75,9 +75,6 @@ public static async Task<List<string>> GetSignedInUsersGroups(TokenValidatedCont
7575

7676
if (identity != null)
7777
{
78-
// Remove any existing groups claim
79-
RemoveExistingClaims(identity);
80-
8178
// Re-populate the `groups` claim with the complete list of groups fetched from MS Graph
8279
foreach (Group group in allgroups)
8380
{
@@ -116,23 +113,6 @@ public static async Task<List<string>> GetSignedInUsersGroups(TokenValidatedCont
116113
return groupClaims;
117114
}
118115

119-
/// <summary>
120-
/// Remove groups claims if already exists.
121-
/// </summary>
122-
/// <param name="identity"></param>
123-
private static void RemoveExistingGroupsClaims(ClaimsIdentity identity)
124-
{
125-
//clear existing claim
126-
List<Claim> existingGroupsClaims = identity.Claims.Where(x => x.Type == "groups").ToList();
127-
if (existingGroupsClaims?.Count > 0)
128-
{
129-
foreach (Claim groupsClaim in existingGroupsClaims)
130-
{
131-
identity.RemoveClaim(groupsClaim);
132-
}
133-
}
134-
}
135-
136116
/// <summary>
137117
/// Returns all the groups that the user is a direct member of.
138118
/// </summary>

0 commit comments

Comments
 (0)