Skip to content

Commit 4cf96da

Browse files
authored
Merge pull request #20 from jabbera/userRequestedFixed
Don't send header if email or groups are null or empty
2 parents 32ba3ea + 04a4aed commit 4cf96da

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

RutaHttpModule/RutaModule.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,15 @@ private void HandleAuthorizeRequestInternal(IRutaHttpContext context)
158158
context.RemoveRequestHeader("Authorization"); // Remove the authorzation header since we are in charge of authentication
159159
context.AddRequestHeader(this.settings.LoginHeader, loginToSend);
160160
context.AddRequestHeader(this.settings.NameHeader, name);
161-
context.AddRequestHeader(this.settings.EmailHeader, email);
162-
context.AddRequestHeader(this.settings.GroupsHeader, string.Join(",", groupsToSend));
161+
if (!string.IsNullOrWhiteSpace(email))
162+
{
163+
context.AddRequestHeader(this.settings.EmailHeader, email);
164+
}
165+
166+
if (groupsToSend?.Length > 0)
167+
{
168+
context.AddRequestHeader(this.settings.GroupsHeader, string.Join(",", groupsToSend));
169+
}
163170
}
164171

165172
private (string login, string name, string email, string[] groups) GetUserInformation(string userName)

0 commit comments

Comments
 (0)