Skip to content

Commit

Permalink
fix(desktop): Include port in credential name if not using the default
Browse files Browse the repository at this point in the history
  • Loading branch information
VMelnalksnis committed Feb 24, 2024
1 parent 2a06ee6 commit 8810ac5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
4 changes: 4 additions & 0 deletions docs/changelog.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ <h3>Changed</h3>
Split current loans in named loans and loan payments in
<a href="https://github.com/VMelnalksnis/Gnomeshade/pull/1104">#1104</a>
</li>
<li>
Include non-default port in stored credential name in
<a href="https://github.com/VMelnalksnis/Gnomeshade/pull/1113">#1113</a>
</li>
</ul>
</section>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,14 @@ private bool TryGetCredential([NotNullWhen(true)] out ICredential? credential)
private string GetCredentialName()
{
const string credentialName = "Gnomeshade";
var serverHost = _optionsMonitor.CurrentValue.BaseAddress?.Host;
var baseUri = _optionsMonitor.CurrentValue.BaseAddress;

Check warning on line 125 in source/Gnomeshade.Desktop/Authentication/WindowsCredentialStorageService.cs

View check run for this annotation

Codecov / codecov/patch

source/Gnomeshade.Desktop/Authentication/WindowsCredentialStorageService.cs#L125

Added line #L125 was not covered by tests
if (baseUri is null)
{
return credentialName;

Check warning on line 128 in source/Gnomeshade.Desktop/Authentication/WindowsCredentialStorageService.cs

View check run for this annotation

Codecov / codecov/patch

source/Gnomeshade.Desktop/Authentication/WindowsCredentialStorageService.cs#L128

Added line #L128 was not covered by tests
}

return string.IsNullOrWhiteSpace(serverHost)
? credentialName
: $"{credentialName}:{serverHost}";
return baseUri.IsDefaultPort
? $"{credentialName}:{baseUri.Host}"
: $"{credentialName}:{baseUri.Host}:{baseUri.Port}";

Check warning on line 133 in source/Gnomeshade.Desktop/Authentication/WindowsCredentialStorageService.cs

View check run for this annotation

Codecov / codecov/patch

source/Gnomeshade.Desktop/Authentication/WindowsCredentialStorageService.cs#L132-L133

Added lines #L132 - L133 were not covered by tests
}
}

0 comments on commit 8810ac5

Please sign in to comment.