Skip to content

Commit

Permalink
Consider domain matched when no domain hint is provided in GitHub acc…
Browse files Browse the repository at this point in the history
…ount filtering
  • Loading branch information
de1acr0ix committed Jan 27, 2024
1 parent 70c4dd0 commit 8cb1b9c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/shared/GitHub.Tests/GitHubAuthChallengeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,9 @@ public void GitHubAuthChallenge_FromHeaders_EmptyHeaders_ReturnsEmpty()
[InlineData("", false)]
[InlineData(" ", false)]
[InlineData("alice", true)]
[InlineData("alice_contoso", false)]
[InlineData("alice_CONTOSO", false)]
[InlineData("alice_contoso_alt", false)]
[InlineData("alice_contoso", true)]
[InlineData("alice_CONTOSO", true)]
[InlineData("alice_contoso_alt", true)]
[InlineData("pj_nitin", true)]
[InlineData("up_the_irons", true)]
public void GitHubAuthChallenge_IsDomainMember_NoHint(string userName, bool expected)
Expand Down
7 changes: 6 additions & 1 deletion src/shared/GitHub/GitHubAuthChallenge.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,15 @@ public bool IsDomainMember(string userName)
return false;
}

if (string.IsNullOrWhiteSpace(Domain))
{
return true;
}

int delim = userName.LastIndexOf('_');
if (delim < 0)
{
return string.IsNullOrWhiteSpace(Domain);
return false;
}

// Check for users that contain underscores but are not EMU logins
Expand Down

0 comments on commit 8cb1b9c

Please sign in to comment.