Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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